473,503 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Viewstate of dynamically created controls

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.
Nov 18 '05 #1
2 1124
I found this on the web
http://www.tek-tips.com/gviewthread....855/qid/870851

A programmer says
(yes, the reconstructed controls WILL load their old properties from the
ViewState).

this explains why visible datagrids stay visible , but why do I have to
reload their data ???
Nov 18 '05 #2
Understanding ASP.NET ViewState
http://msdn.microsoft.com/library/de.../viewstate.asp

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke
"yufufi" <yu****@ttnet.net.tr> wrote in message
news:er**************@TK2MSFTNGP10.phx.gbl...
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.

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
21626
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
3
2413
by: Kenton Smeltzer | last post by:
Hello All, I am having a problem with events and the addition of controls on a page I am developing. First let me tell you what I have tried and then maybe someone can see something I missed. ...
0
2098
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
0
1006
by: Don | last post by:
I need some suggests on how to manage the viewState on my page. I have multiple checkBoxLists that are dynamically created and need then synced up with the viewstate. My problem is that on each...
6
2837
by: hlubocky | last post by:
I thought I had a good grasp of the problem related to dynamically creating controls, but it appears that as my application grew in complexity, the problem has resurfaced. As I understand it, in...
6
2058
by: hitendra15 | last post by:
Hi I have created web user control which has Repeater control and Linkbutton in ItemTemplate of repeater control, following is the code for this control On first load it runs fine but when...
1
2495
by: Andrew Robinson | last post by:
I have a <asp:table> control with a large number of dynamically created LinkButtons. I am using the command event, command name and command argument values in my LinkButtons to trigger actions...
3
2575
by: HP | last post by:
Hi there The problem of dynamically created controls vs viewstate is widely known one. To access values of controls they have to be recreated on Page_Load. Unfortunately it causes many...
2
2196
by: Dica | last post by:
i've got a simple page with a dropdown list of employees and a series of checkboxs showing their skills. the checkboxs are created dynamically from a sql statement and viewstate = false is set on...
0
2222
by: Scott Roberts | last post by:
I always thought that the viewstate "keys" included the control ID. As long as the control IDs were unique, there shouldn't be any conflicts. Well, it appears that that may not be the case with...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
382
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.