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

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

    Please give me suggestions on this.


    Bryan, Aug 22, 2006
    1. Advertisements

  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, Aug 23, 2006
    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.