Edit data in a repeater?

G

Guest

Hi All

I am trying to find a way of displaying data in a datatable in such a way that ALL rows (only about 5 - 10) are editable and are updated from a single button press. I thought the best way would be to use a repeater to display the data in textboxes, then when the button is pressed to iterate through the repeater control and find all the text boxes and update the DB with the values, but I have come across a couple of problems

The main one that I need to solve is: how do I find each textbox control when I postback the data on the button press? If anyone has done this before, or has a better way of doing it, I would be grateful if you let me know

The repeater code on my page is

<asp:Repeater id="rptThreads" runat="server"><HeaderTemplate><table cellSpacing="1" cellPadding="1" border="0"></HeaderTemplate><ItemTemplate><TR><TD width="200">Doc Type(s)</TD><TD><asp:TextBox Text='<%# Container.DataItem("file_type") %>' size="60" runat="server"></asp:TextBox><asp:TextBox Text='<%# Container.DataItem("max_threads") %>' size="5" runat="server"></asp:TextBox></TD></TR></ItemTemplate><FooterTemplate></table></FooterTemplate></asp:Repeater>
 
A

avnrao

You can use
Repeater.Items.FindControl("controlName") and cast it to the respective
control.

Av.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top