Edit data in a repeater?

Discussion in 'ASP .Net' started by Guest, May 14, 2004.

  1. Guest

    Guest 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>
     
    Guest, May 14, 2004
    #1
    1. Advertisements

  2. Guest

    avnrao Guest

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

    Av.
     
    avnrao, May 14, 2004
    #2
    1. Advertisements

  3. Guest

    Scott Allen Guest

    Scott Allen, May 14, 2004
    #3
  4. Guest

    mehmood

    Joined:
    Sep 12, 2011
    Messages:
    1
    Likes Received:
    0
    mehmood, Sep 12, 2011
    #4
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.