Note that there are some explanatory texts on larger screens.

plurals
  1. POGet text from a <th> using c#
    primarykey
    data
    text
    <p>I need to extract some text from a HTML table</p> <p>I tried using </p> <pre><code>tblGridHeader.Rows[0].InnerText.ToString() </code></pre> <p>But I'm getting the error of </p> <blockquote> <p>"HTMLTableRow" does not support InnerText property.</p> </blockquote> <p>I also tried InnerHTML, and still no go.</p> <p>I did try using the cells property, but I'm getting an error of </p> <blockquote> <p>Specified argument was out of the range of valid values.</p> </blockquote> <p><strong>Note:</strong> I just tried the cells property on a static table and it worked. So I guess it's something to do with my table being dynamically populated?</p> <p>Code from visual studio editor:</p> <pre><code>&lt;div id="divGridHeader" runat="Server" style="width:771px; text-align:left; overflow:hidden; float:left"&gt; &lt;table cellpadding="0" cellspacing="0" border="0" id="tblGridHeader" runat="Server"&gt; &lt;tr id="trMonth" runat="Server" class="fixedHeader"&gt; &lt;/tr&gt; &lt;tr id="trDaysOfWeek" runat="Server" class="fixedHeader"&gt; &lt;/tr&gt; &lt;tr id="trDaysInMonth" runat="Server" class="fixedHeader"&gt; &lt;/tr&gt; &lt;tr id="trFteLimit" runat="Server" class="fixedHeader" style="color:Black"&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Code from browser:</p> <pre><code>&lt;div id="ctl00_cphWorkforceScheduler_divGridHeader" style="overflow: hidden; width: 771px; text-align: left; float: left;"&gt; &lt;table id="ctl00_cphWorkforceScheduler_tblGridHeader" cellspacing="0" cellpadding="0" border="0" width="1085"&gt; &lt;tbody&gt; &lt;tr id="ctl00_cphWorkforceScheduler_trMonth" class="fixedHeader"&gt; &lt;/tr&gt; &lt;tr id="ctl00_cphWorkforceScheduler_trDaysOfWeek" class="fixedHeader"&gt; &lt;/tr&gt; &lt;tr id="ctl00_cphWorkforceScheduler_trDaysInMonth" class="fixedHeader"&gt; &lt;th id="ctl00_cphWorkforceScheduler_thDay_10012010120000AM" class="tt" onmouseout="HideToolTip(ctl00_cphWorkforceScheduler_spnWorkforceToolTip_ctl00_cphWorkforceScheduler_thDay_10012010120000AM, ctl00_cphWorkforceScheduler_spnWorkforceToolTipMiddle_ctl00_cphWorkforceScheduler_thDay_10012010120000AM);" onmouseover="ShowToolTip(ctl00_cphWorkforceScheduler_spnWorkforceToolTip_ctl00_cphWorkforceScheduler_thDay_10012010120000AM, ctl00_cphWorkforceScheduler_spnWorkforceToolTipMiddle_ctl00_cphWorkforceScheduler_thDay_10012010120000AM, '135px');" style="background-repeat: repeat-x; text-align: center; font-size: 8pt; font-weight: normal; background-image: url(../Images/TitleGradientMiddle.JPG); height: 20px; width: 35px; text-decoration: none;"&gt; &lt;/th&gt; &lt;th id="ctl00_cphWorkforceScheduler_thDay_10022010120000AM" class="tt" onmouseout="HideToolTip(ctl00_cphWorkforceScheduler_spnWorkforceToolTip_ctl00_cphWorkforceScheduler_thDay_10022010120000AM, ctl00_cphWorkforceScheduler_spnWorkforceToolTipMiddle_ctl00_cphWorkforceScheduler_thDay_10022010120000AM);" onmouseover="ShowToolTip(ctl00_cphWorkforceScheduler_spnWorkforceToolTip_ctl00_cphWorkforceScheduler_thDay_10022010120000AM, ctl00_cphWorkforceScheduler_spnWorkforceToolTipMiddle_ctl00_cphWorkforceScheduler_thDay_10022010120000AM, '135px');" style="background-repeat: repeat-x; text-align: center; font-size: 8pt; font-weight: normal; background-image: url(../Images/TitleGradientMiddle.JPG); height: 20px; width: 35px; text-decoration: none;"&gt; </code></pre> <p>Etc, etc. I didn't paste everything since there's a lot of tags. Please assume that HTML is well formed.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload