DataList: Collecting IDs and TextBox values at same time

Joined
Aug 24, 2009
Messages
1
Reaction score
0
I have a datalist with 2 columns of products with a TextBox next to each product so my customer can enter a number in each checkbox (to determine the order sequence when this list of products is printed to the screen). I have a button for my customer to click when she is happy with the sequence chosen for each product and this calls a subroutine within which I need to be able to collect each productID and the number entered into the textbox next to it. This worked perfectly in my old system using Classic ASP and can't understand why it's so difficult to offer the same funtionality in ASP.Net! I have tried various approaches but none of them work in collecting the number entered into the TextBox and the ProdId at the same time. I tried storing the ProductId in the ID of the TextBox in the hope that I could then retrieve both the ProductId and the value of the TextBox for each product when the button is clicked but values of the TextBox ID are values such as 567 or 784 and are set dynamically (these are the productIds). The error I'm getting is as follows:

The ID property of a control can only be set using the ID attribute in the tag and a simple value. Example: <asp:Button runat="server" id="Button1" />
and the line containing the error is:
<asp:TextBox runat="server" ID='<%# DataBinder.Eval(Container.DataItem, "Prod_ID")%>' Text='<%# DataBinder.Eval(Container.DataItem, "Sequence1")%>'></asp:TextBox>

Any advice would be greatly apreciated.
Thanks, Lorna
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top