Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting the databound value from repeater control in asp.net
    primarykey
    data
    text
    <p>As a follow up to my question <a href="https://stackoverflow.com/questions/7043829/looping-through-a-repeater-control-to-get-values-of-textbox-in-asp-net">Looping through a repeater control to get values of Textbox in asp.net</a> If user has entered a a quantity in the textbox, I want to get the corresponding ProductID value from the repeater control: </p> <pre><code>&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="Supply Name"&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;asp:Label ID="lblProductName" Text="&lt;%#Trim(Eval("Product_Title"))%&gt;" &gt;&lt;%#Trim(Eval("Supplie_title"))%&gt;&lt;/asp:Label&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> <p>My codebehind is: </p> <pre><code>For Each item As RepeaterItem In rptRequestForm.Items txtField = item.FindControl("txtBox") If Not IsNothing(txtField) Then j += 1 strText = strText &amp; ", " &amp; txtField.Text End If Next </code></pre> <p>I am using FindControl to loop through the textbox (to see if user has entered a valid quantity). How can I get the value of the corresponding ProductID ?</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.
 

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