Dynamic gridview values lost on postback

B

Bryan

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
 
V

Vadivel Kumar

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.
 

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top