473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 16 '05 #1
2 1455
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 16 '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 16 '05 #3

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

Similar topics

9
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.