Note that there are some explanatory texts on larger screens.

plurals
  1. POLooping through a repeater control to get values of Textbox in asp.net
    primarykey
    data
    text
    <p>I am trying to loop through my repeater control and get the textbox values.<br> However, I am getting an error: </p> <p><strong>{"Object reference not set to an instance of an object."}</strong> </p> <p>my code is: </p> <pre><code> Dim txtField As TextBox Dim j As Integer = 0 'Confirm if user has entered atleast one quantity For Each item In rptRequestForm.Items txtField = rptRequestForm.FindControl("txtBox") If txtField.Text &lt;&gt; Nothing Then j += 1 Else End If Next </code></pre> <p><strong>UPDATE:</strong> aspx code is: </p> <pre><code> &lt;td&gt;&lt;asp:Repeater ID="rptRequestForm" runat="server"&gt; &lt;HeaderTemplate&gt; &lt;table border="0" width="100%"&gt; &lt;tr&gt; &lt;td style="width:50%" class="TextFontBold"&gt;&lt;asp:Label runat="server" ID="Label1" Text="Product"&gt;&lt;/asp:Label&gt;&lt;/td&gt; &lt;td style="width:25%" class="TextFontBold"&gt;&lt;asp:Label runat="server" ID="Label2" Text="Quantity"&gt;&lt;/asp:Label&gt;&lt;/td&gt; &lt;td style="width:25%" class="TextFontBold"&gt;&lt;asp:Label runat="server" ID="Label3" Text="Price (ea.)"&gt;&lt;/asp:Label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;table border="0" width="100%"&gt; &lt;tr&gt; &lt;td style="width:50%" class="TextFont"&gt;&lt;span&gt;&lt;%#Trim(Eval("Product_Title"))%&gt;&lt;/span&gt;&lt;/td&gt; &lt;td style="width:25%"&gt;&lt;asp:TextBox ID="txtBox" runat="server" Width="30%" onblur="Javascript:numberonly(this)"&gt;&lt;/asp:TextBox&gt;&lt;/td&gt; &lt;td style="width:25%" class="TextFont"&gt;&lt;span&gt;&lt;%#Trim(FormatCurrency(Eval("Price")))%&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre>
    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