question about viewstate

F

Francis

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>
 
G

Guest

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)
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top