Avoiding databind to be called twice between postbacks

N

Nishanth

Hi,

I have a datagrid to which the columns are added dynamically. For the
viewstate to persist for the dynamically added columns I'm adding all the
columns again between postbacks.

I have the following 2 methods
1. "AddColumns()" - This dynamically adds the columns to the grid fby
reading a configuration file.
2. "BindGrid()" - Fetches the data from the Database and Binds it to the
grid.

The problem is that when the user clicks on the update button on the grid. I
have to call both AddColumns() and BindGrid() initially so that the
viewstate is restored and I get the new values entered in the grid. Then
after retrieving the data from the controls (TextBoxes) and updating the
information back to the database I have to again call the BindGrid() method
and bind it to the datagrid.

Please let me know if it possible to avoid the call of BindGrid() Method for
restoring the Viewstate of the dynamically added columns.

Thanks for any help provided.
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top