Edit data in a repeater?

Discussion in 'ASP .Net' started by =?Utf-8?B?U3RldmU=?=, May 14, 2004.

  1. 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>
    =?Utf-8?B?U3RldmU=?=, May 14, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?U3RldmU=?=

    avnrao Guest

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

    Av.
    "Steve" <> wrote in message
    news:...
    > 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>
    avnrao, May 14, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?U3RldmU=?=

    Scott Allen Guest

    There is some code demonstrating exactly what you describe in the
    following article:

    http://odetocode.com/Articles/116.aspx

    HTH,

    --
    Scott

    On Fri, 14 May 2004 03:56:02 -0700, "Steve" <> wrote:

    >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>


    --
    Scott
    http://www.OdeToCode.com
    Scott Allen, May 14, 2004
    #3
  4. =?Utf-8?B?U3RldmU=?=

    mehmood

    Joined:
    Sep 12, 2011
    Messages:
    1
    mehmood, Sep 12, 2011
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. San Diego Guy
    Replies:
    0
    Views:
    531
    San Diego Guy
    Aug 7, 2003
  2. Schultz
    Replies:
    3
    Views:
    544
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Feb 14, 2005
  3. =?Utf-8?B?a2Vu?=
    Replies:
    1
    Views:
    10,309
    Wiktor Zychla [C# MVP]
    Jan 23, 2006
  4. Sharon McCarty
    Replies:
    0
    Views:
    240
    Sharon McCarty
    Nov 24, 2004
  5. Frank Kurka
    Replies:
    8
    Views:
    288
Loading...

Share This Page