Edit data in a repeater?

  • Thread starter Thread starter Guest
  • Start date Start date
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>
 
You can use
Repeater.Items.FindControl("controlName") and cast it to the respective
control.

Av.
 
Back
Top