?
Solved

How does setting EnableViewstate to false really function ?

Posted on 2003-10-28
9
Medium Priority
?
437 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Industry Leaders: 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!

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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

771 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