Viewstate of dynamically created controls

Y

yufufi

My web page contains only a panel control and I add datagrids at runtime.
Viewstate for the datagrids are enabled but every time I postback the page I
have to re bind data to data grids.
I figured out this: (?)
when I do a postback , asp.net looks to the html of the page and can't find
the datagrids. It finds only the panel and loads its state ?

everything is ok until this point .. but ,
my datagrids are not visible at the beginning. I also add buttons to the
page (at run time) . When user clicks to the button I change the visible
property of the datagrid to true. Interesting thing is when user clicks to
another button the first datagrid stays visible. (on page load I change the
datagrids' visible property to false)
Actually this is something I want but I can't understand how does asp.net
figures out which datagrid is visible and which is not ?? If it can remember
that why can't it remember the datagrids on the page ?

Thanx a lot
yufufi,

PS there is no ispostback check on the page.. so only thing different
between postbacks is state.
 

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,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top