Editing Multiple Rows At Once in datagrid -- Please help

Discussion in 'ASP .Net Web Controls' started by Reetu, Nov 2, 2004.

  1. Reetu

    Reetu Guest

    Hi all,

    I am referring to one of the msdn articles which explains
    how to edit multiple rows at once in datagrid.

    Query:
    In pageload the datagrid is displayed with data in it. In
    the textbox(contained in the datagrid) I change the data
    and click on the save button located on the web form.

    Now I am expecting the edited value to be available in my
    following code.

    txtQuantity = (TextBox) dgi.FindControl("txtQuantity");

    But I see that the textbox retains the previous value.
    here is the code I am using.

    Can someone please tell me why I am getting the initial
    value instead of the modified value.

    int i;
    DataGridItem dgi;
    TextBox txtQuantity;
    Label lblDescription;
    Label lblPrice;
    Label lblTotal;

    for(i = 0; i <= DataGrid1.Items.Count -1 ; i++)
    {
    dgi = DataGrid1.Items;
    txtQuantity = (TextBox) dgi.FindControl("txtQuantity");
    lblDescription = (Label)dgi.FindControl("lblDescription");
    lblPrice = (Label)dgi.FindControl("lblPrice");
    lblTotal = (Label)dgi.FindControl("lblTotal");
    .......
    }

    Thanks & Regards,
    -Reetu
    Reetu, Nov 2, 2004
    #1
    1. Advertising

  2. Reetu

    Reetu Guest

    Hi all,

    I got it working. I need to set the
    DataGrid.EnableViewstate property to false.

    Thanks,
    -Reetu
    >-----Original Message-----
    >Hi all,
    >
    >I am referring to one of the msdn articles which explains
    >how to edit multiple rows at once in datagrid.
    >
    >Query:
    >In pageload the datagrid is displayed with data in it. In
    >the textbox(contained in the datagrid) I change the data
    >and click on the save button located on the web form.
    >
    >Now I am expecting the edited value to be available in my
    >following code.
    >
    >txtQuantity = (TextBox) dgi.FindControl("txtQuantity");
    >
    >But I see that the textbox retains the previous value.
    >here is the code I am using.
    >
    >Can someone please tell me why I am getting the initial
    >value instead of the modified value.
    >
    >int i;
    >DataGridItem dgi;
    >TextBox txtQuantity;
    >Label lblDescription;
    >Label lblPrice;
    >Label lblTotal;
    >
    >for(i = 0; i <= DataGrid1.Items.Count -1 ; i++)
    >{
    >dgi = DataGrid1.Items;
    >txtQuantity = (TextBox) dgi.FindControl("txtQuantity");
    >lblDescription = (Label)dgi.FindControl("lblDescription");
    >lblPrice = (Label)dgi.FindControl("lblPrice");
    >lblTotal = (Label)dgi.FindControl("lblTotal");
    >.......
    >}
    >
    >Thanks & Regards,
    >-Reetu
    >.
    >
    Reetu, Nov 2, 2004
    #2
    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. Brian
    Replies:
    1
    Views:
    2,749
    Brian
    Dec 22, 2003
  2. Vili
    Replies:
    1
    Views:
    529
    S. Justin Gengo
    Mar 31, 2006
  3. Replies:
    0
    Views:
    271
  4. Hrvoje Vrbanc

    One button for editing all rows of a DataGrid

    Hrvoje Vrbanc, Sep 23, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    159
    Saravana
    Sep 24, 2003
  5. Replies:
    0
    Views:
    222
Loading...

Share This Page