View state of server controls confusing

  • Thread starter Thread starter kobosh3
  • Start date Start date
K

kobosh3

Guest
I must confess I am not able to understand view state. I have web form with view state disabled for the page and a textbox and input text (with run at server) . Both text boxes have initial text/value. When I change the text for text box and input and then click the submit button : what is going to happen? do the changes I made survive post back or are they replaced back by the original values which were set in html? To my confusion both texts survived post back. The values set in html were replaced by the new changed values. So disabling view state had no effect. Can some one please explain this to me?

<%@ Page Language="C#" AutoEventWireup="true" Theme="Green" EnableViewState="false" CodeBehind="WebForm1.aspx.cs" Inherits="WebFormDataSources.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>



<asp:TextBox ID="TextBox1" runat="server" Text="this text" EnableViewState="false"></asp:TextBox>

<asp:Button Text="this is a button" runat="server" OnClick="Unnamed1_Click" />
<asp:Literal ID="lbl" runat="server"></asp:Literal>
<div><input type="text" id="inp" value="test" runat="server" enableviewstate="false" /> </div>
</form>
</html>

Continue reading...
 
Back
Top