Solved

How does setting EnableViewstate to false really function ?

Posted on 2003-10-28
9
436 Views
Last Modified: 2012-08-13
I have created a simple web application using Visual Studio.NET as follows :

<%@ Page Language="VB" EnableViewstate="false" %>
<HTML>
   <BODY>
      <FORM Runat="server">
         Enter Your Name : <asp:textbox Id = "tbxMessage" Runat="server"/>
         <asp:button Id="btnSubmit" Text="Submit" Runat="server"/>      
      </FORM>
   </BODY>
</HTML>

I believe after submitting the page with some text in the text box the page should be re-displayed with the textbox being empty in the manner that a traditional asp page works, since I've set the EnableViewstate attribute to "false".

However, when I've found after submitting the page, that it re-displays the text that was input into the text box after it returns.
When I checked the source of the returned page, it did display a ViewState hidden element in it.

I was trying to understand how exactly "viewstate" works by creating a simple page. Is my understanding of the viewstate as mentioned in the para immediately above incorrect ? What am I missing. Kindly guide me.
0
Comment
Question by:x666xchange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 9635445
x666xchange,
It would erase you history. You may try this as well :
 <FORM Runat="server" autocomplete="off">
        Enter Your Name : <asp:textbox Id = "tbxMessage" Runat="server"/>
        <asp:button Id="btnSubmit" Text="Submit" Runat="server"/>      
     </FORM>

-set the property for autocomplete="false"
0
 
LVL 4

Expert Comment

by:kblack15217
ID: 9635456
Try using EnableViewState="false".  Caps sensative.  Your understading of viewstate is correct
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 9635487
In case this helps:

http://www.w3schools.com/aspnet/aspnet_viewstate.asp


Caching issue?

Fritz the Blank
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:x666xchange
ID: 9671675
I have tried setting autocomplete to "false" aswell as "off" for the form. Even tried setting the AUTOCOMPLETE feature directly in IE to unchecked.

None of the above worked. Any other suggestions please. Just can't figure out what's going wrong.
0
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
ID: 9676498
x666xchange,
It's  autocomplete ="off", if you set this property, your previous data wouldn't display again. However, if you prefer which control cant display the previous data, simply set this property inside the control.

<FORM Runat="server" autocomplete="off"> <---------All the control inside <Form> wouldn't display the history input

<Input Type="Text" id="txtInput" autoComplete="off"> <--reset history only for this control.

If autocomplete property not your main problems, let figure out the problems from EnableViewstate property.
For your info., EnableViewstate is set to True by default. To set it to false for all the page resist inside your project, just simply set in inside web.config. I think you have set it to true in someway, try to check again.

Regards
x_com
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11632571
to x_com?

FtB
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question