Link to home
Start Free TrialLog in
Avatar of mocaiv
mocaiv

asked on

datagrid losing controls on postback

I have a datagrid that auto generates columns set to TRUE.  The general layout of this grid is as follows:

Company 1  |   Company 2 |  Company 3 | Company 4 ....
textbox                 DDL             DDL                 DDL
textbox                 DDL             DDL                 DDL
textbox                 DDL             DDL                 DDL
etc..

the reason im using auto generate is because the column headers are names of companies, and depending on the data that i get back, there will be a variable amount of columns(companies).

so i simply generate a datatable with the correct formating, bind it to the datagrid's datasource,
then on ItemDataBound, i dynamically add controls to the cells which will container either a dropdownlist with data in it, or a textbox (each cell will depend on conditions)

all of this works, however, when i postback on anything, the columns stay, but i lose all my controls.  even if i have it re add those controls on every postback, then i still lose the state of their selected values.
the dropdownlists in the grid do not have autopostback set, so we are posting back on other parts of the page.

is there anything that can be done thats relatively simple?
ASKER CERTIFIED SOLUTION
Avatar of samtran0331
samtran0331
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial