Dynamic gridview values lost on postback

Discussion in 'ASP .Net Web Controls' started by Bryan, Aug 22, 2006.

  1. Bryan

    Bryan Guest

    Hi all,

    I am developing an application that uses a GridView that has its
    columns added dynamically.

    The user selects from a Drop Down List of offices, this populates a
    list of employees, the user selects one.

    Clicking the "Add_Emp" button adds column relating to this employee to
    a DataTable myDT, the DataTable is then bound to the GridView. All is
    working fine here.

    I also store the myDT in the session so that I can repopulate the
    gridview on postback with the information for the DataTable


    The problem -
    When the user makes changes to the CheckBoxes in the Gridview, I
    want to update the DataTable before it is used to repopulate the
    GridView.

    But, the GridView is empty on postback because it is dynamic.

    Please give me suggestions on this.

    Thanks,

    Bryan
     
    Bryan, Aug 22, 2006
    #1
    1. Advertising

  2. I guess, grid view shouldn't be empty if you have ViewState enabled for
    that control. Even in postback condition you can track the CheckBox state.

    Check for the ViewState and AutoPostBack properties.

    --
    Vadivel Kumar
    http://www.vadivelk.net
    (remove "online.")

    Bryan wrote:
    > Hi all,
    >
    > I am developing an application that uses a GridView that has its
    > columns added dynamically.
    >
    > The user selects from a Drop Down List of offices, this populates a
    > list of employees, the user selects one.
    >
    > Clicking the "Add_Emp" button adds column relating to this employee to
    > a DataTable myDT, the DataTable is then bound to the GridView. All is
    > working fine here.
    >
    > I also store the myDT in the session so that I can repopulate the
    > gridview on postback with the information for the DataTable
    >
    >
    > The problem -
    > When the user makes changes to the CheckBoxes in the Gridview, I
    > want to update the DataTable before it is used to repopulate the
    > GridView.
    >
    > But, the GridView is empty on postback because it is dynamic.
    >
    > Please give me suggestions on this.
    >
    > Thanks,
    >
    > Bryan
    >
     
    Vadivel Kumar, Aug 23, 2006
    #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. K B
    Replies:
    0
    Views:
    7,099
  2. Paul
    Replies:
    1
    Views:
    405
    =?Utf-8?B?UHJlbSBLdW1hcg==?=
    Aug 30, 2006
  3. vcuankitdotnet

    Dynamic Controls Lost On Postback

    vcuankitdotnet, Apr 16, 2007, in forum: ASP .Net
    Replies:
    5
    Views:
    6,253
    Thomas Hansen
    Apr 18, 2007
  4. UserControl values lost on PostBack

    , Aug 30, 2006, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    163
  5. UserControl values lost on PostBack

    , Aug 30, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    403
Loading...

Share This Page