473,394 Members | 1,699 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,394 software developers and data experts.

question about viewstate

Hi,

i'm testing ViewState with this page here below:
i tried with EnableViewState="false" and with EnableViewState="true", but
the produced source code is the same in both cases. I would expect here no
hidden" name="__VIEWSTATE in the source because of 'false' ...

If someone could explain this.
Thanks
Francis

aspx page:
<%@ Page Language="VB" EnableViewState="false" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>

<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>

source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMjgzMDgzOTgzZGRuyJfSk1ZKnyyyXSj8ebdYy31LDA= =" />
</div>
<div>
<input name="TextBox1" type="text" id="TextBox1" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEWAgLl5ZHgCQLs0bLrBohnJoqsGn5BNs4p/EWSTVSTTRel" />
</div></form>
</body>
</html>
May 24 '07 #1
1 2074
On May 24, 9:41 pm, "Francis" <xwrote:
Hi,

i'm testing ViewState with this page here below:
i tried with EnableViewState="false" and with EnableViewState="true", but
the produced source code is the same in both cases. I would expect here no
hidden" name="__VIEWSTATE in the source because of 'false' ...

If someone could explain this.
Thanks
Francis

aspx page:
<%@ Page Language="VB" EnableViewState="false" AutoEventWireup="false"
CodeFile="Default.aspx.vb" Inherits="_Default" %>

<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>

source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
Untitled Page
</title></head>
<body>
<form name="form1" method="post" action="Default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUJMjgzMDgzOTgzZGRuyJfSk1ZKnyyyXSj8ebdYy31LDA= =" />
</div>
<div>
<input name="TextBox1" type="text" id="TextBox1" />
</div>
<div>
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
value="/wEWAgLl5ZHgCQLs0bLrBohnJoqsGn5BNs4p/EWSTVSTTRel" />
</div></form>
</body>
</html>
It keeps an information about 1) view state data and 2) control
hierarchy. And even you turned a viewstate off 1) you will still have
that hidden field because of 2)

May 24 '07 #2

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

Similar topics

2
by: Mike P | last post by:
I have the following code in my Page_Load event to populate a listbox from a database : if (!(Page.IsPostBack)) { SqlConnection objConnection = new...
5
by: Craig Buchanan | last post by:
I'm using a viewstate key/value to store a serialized instance of a class. If I redirect to another aspx page, the viewstate is lost. Is this the intended behavior of the viewstate? Is there a...
2
by: Gandalf | last post by:
Say I have persisted a DataSet in the ViewState of a page, and that when the page is posted back I make several references to that dataset like so: DataSet MyDataSet = (DataSet)ViewState; //C#...
1
by: Raed Sawalha | last post by:
Hi I have created a usercontrol in which I save a value in viewstate like this: ViewState=value; If I use the same key (ViewState=value;) in my master page, does the framework recognize where the...
6
by: Chris | last post by:
I've created two textboxes and one button on my web form. I then set the EnableViewState property of Textbox1 to False. Textbox2 is set to True. The button has no code in it - It simply has an...
6
by: John | last post by:
Hi all, I am using dynamic user controls within my web app and these controls are loaded into placeholders via the LoadControl method. My problem is this: I have usercontrolA loaded into a...
6
by: Bryan | last post by:
I've got an ASP.NET application running that has a non-visual user interface (it's a voice app using VXML.) The voice client understands cookies and when it requests and aspx page, what actually...
5
by: Mark Olbert | last post by:
I have a composite control (under ASPNET2; derived from CompositeControl) which contains a label. The contents of the label are set when the control is created to a user-supplied value. What's...
2
by: Carly | last post by:
Hi, I am now not sure I understand what ViewState does. Having EnableViewState=true or false on a WEB form and/or different server controls does not seem to make any difference. I am just...
5
by: jehugaleahsa | last post by:
Hello: What is the point of using a DataTable in ASP .NET? We are unsure how you can use them without 1) rebuilding them every postback, or 2) taking up precious memory. We are not sure how to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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
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...

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.