Ask a Question related to ASP.NET General, Design and Development.
-
Dave Verwer #1
EnableViewState = false not working
Hi
I have a problem which is easily reproducable using VS.NET 2003 and the .Net
framework 1.1 (not tested with framework 1.0) regarding disabling ViewState
for dynamically created controls.
Basically setting EnableViewState=false on controls created dynamically does
not stop the viewstate being stored! I have tried this at the control level
(setting EnableViewState = false for every control), at the Page level with
the @ Page directive and also at the application level in web.config and
nothing reduces the size of the viewstate. I have double checked with
ASP.NET tracing that it is the viewstate for the controls I am creating and
have confirmed this by looking at the Control Tree section which gives
viewstate size information as well as actually measuring the size of the
VIEWSTATE variable in the View Source of the compiled page.
To reproduce this problem, create a new blank web form and drop a Panel
control on it (Panel1). Then on the Page_Load event handler put the
following code:
CheckBox oCheck;
for(int i=0; i<100; i++) {
oCheck = new CheckBox();
oCheck.ID = "cb" + i.ToString();
oCheck.EnableViewState = false;
oCheck.AutoPostBack = true;
Panel1.Controls.Add(oCheck);
}
This creates 100 checkbox controls, switches the view state off and postback
on, gives them a name and adds them into the panel on the form. If you
compile and run this example, it contains 704 bytes of viewstate
information.
Then, modify the code so that the line reads:
oCheck.EnableViewState = true;
When the application is rebuilt and executed, the page still contains 704
bytes of viewstate information.
What am I doing wrong?
Thanks in advance
Dave Verwer
Dave Verwer Guest
-
Enabled = false Not Working! Is this a bug?
Hi All, I'm using a datagrid to display and edit pricing data. The grid uses the LinkButtons for editing deleting etc. I want to lock the... -
Datagrid Enabled = false - Not Working.
Hi All, I'm using a datagrid to display and edit pricing data. The grid uses the LinkButtons for editing deleting etc. I want to lock the... -
enableviewstate=false cause datagrid to disappear
For sorting to work we need to enable viewstate for datagrid. But to avoid excessive load on client machine because of viewstate . You can disable... -
enableviewstate=false, still viewstate information is added
Hi Even though the Viewstate has been disabled, ASP.NET still uses about twenty bytes for Viewstate. Not only can you disable Viewstate at the... -
Using Datagrid with EnableViewState="false" gets wrong DataKeys value
I have created a datagrid with search text boxes on the page that allow the user to filter the list. If I use view state, as in the Example 1,...



Reply With Quote

