473,773 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why textbox is persisted when viewstate is off?


I have a page with a few textboxes. When the page is posted, the textfields
retain their values even though I have viewstate turned off. It's turned
off in 2 different places.
- The control itself.
- Page.EnableView State = false; in page_load.

How do I get the textboxes cleared after a postback without clearning them
programmaticall y?

J.
Nov 18 '05 #1
2 1502
On Wed, 7 Jul 2004 10:50:50 -0700, John Dalberg <jo*****@hotmai l.com>
wrote:

I have a page with a few textboxes. When the page is posted, the
textfields
retain their values even though I have viewstate turned off. It's turned
off in 2 different places.
- The control itself.
- Page.EnableView State = false; in page_load.

How do I get the textboxes cleared after a postback without clearning
them
programmaticall y?

J.


They get automatically populated with the forms' POST values. ViewState
only stores what .NET can't get from the POST data.

Don't know how to do this w/out programmaticall y clearing them, outside of
using some JS on the client side. Perhaps someone else knows of a
workaround...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
Textboxes don't use viewstate to retain their value property.
Standard HTML provides a value property for textboxes so this is what
ASP.NET uses in this case.
Assuming your textboxes start out blank initially, you could try code like
this to get the page to forget its values:

Response.Redire ct(".")

The idea is that you are not posting back to your page, you are requesting a
fresh copy.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"John Dalberg" <jo*****@hotmai l.com> wrote in message
news:19******** *************** ******@40tude.n et...

I have a page with a few textboxes. When the page is posted, the textfields retain their values even though I have viewstate turned off. It's turned
off in 2 different places.
- The control itself.
- Page.EnableView State = false; in page_load.

How do I get the textboxes cleared after a postback without clearning them
programmaticall y?

J.

Nov 18 '05 #3

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

Similar topics

2
3921
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
8
1730
by: Anthony P. Mancini | last post by:
I'm working on a proof of concept that will ultimately be deployed on a load balancer. For the sake of a preliminary demonstration I created a C# object and marked it's attributes as Public Shared Static. I also set the EnableSessions and EnableViewState Page directives to false. Here's the part that stumped me : as I was moving from page to page within the demo, I accidently realized the data I dropped
6
4742
by: Henri | last post by:
Very strange problem : if I write: <asp:TextBox runat="server" id="myBox" /> the control's ViewState stays always empty, so it loses its properties if it's not always displayed. But if I write:
3
9234
by: Mike Dole | last post by:
I experimented with a usercontrol (TagedTextbox), I added a tag property. The tag value however is not persisted on postback (text value's fine)? I worked around it with: Me.ViewState("tag") = txtToelichting.Tag but what's wrong with my code?
2
2241
by: fabrice | last post by:
Hi, I have a trouble with my TextBox Control and it's ViewState in my form... The property for it, is FALSE as following : <form id="frmSearchBre4" runat="Server"> <asp:textbox id="myID" TabIndex="1" EnableViewState="false" MaxLength="50" runat="server" TextMode="SingleLine"> </asp:textbox>
3
1795
by: PJ6 | last post by:
Taken out of context I know this may seem like a strange thing to do, but just take this as an academic question if necessary... Calling methods on a persisted control that has been added to a page that has been rendered and unloaded generates these exceptions - A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll A first chance exception of type 'System.Threading.ThreadAbortException' occurred...
1
1648
by: ganesh22 | last post by:
Hi, Here the below code is for dynamically creating textboxs, its creating fine but after user enters some values in textboxs how can i retrive that values? using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;
1
2060
by: bgernon | last post by:
I have a table that consists of two rows with three cells each row. The cells contain textboxes. I am able to successfully add a new row with textboxes when a button is clicked. The problem is retaining the newly added row with the filled in textboxes on the next button click. I think I am handling my viewstate incorrectly. This code adds the new row: Private Sub addRowsInTable() Dim TextID As Integer Dim TextIDCount...
4
1550
by: ton | last post by:
Hi, I'm using Ajax (AjaxPro) this works fine. (In vb.net) To get update several controls I connect the server and these controls are updated. When saving these values I use aa=page.request("TextboxID") which gives me the modified Text property in case of a combobox i get with this method the selectedkey value. Great !!
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.