473,657 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TextBox COntrol et ViewState

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="frmSearchBr e4" runat="Server">

<asp:textbox id="myID" TabIndex="1" EnableViewState ="false" MaxLength="50"
runat="server" TextMode="Singl eLine">
</asp:textbox>

<asp:ListBox Width="200" Font-Size="10" Font-Name="Arial" id="myid2"
rows="4" Enabled="true"
EnableViewState ="false" runat="server">
</asp:ListBox>

</form>
In my web.config :

<pages buffer="true"
enableSessionSt ate="true"
enableViewState Mac="true"
validateRequest ="true"
autoEventWireup ="true">
</pages>
But when the page is a "postbak" the value of th TextBox control is
maintained. Not in the listBox control (it's right)...I don't know why...
Have you got an explanation ?

Thanks a lot
fabrice
Nov 19 '05 #1
2 2230
the textbox uses viewstate to store the previous value so it can fire the
text changed event, whether its set enabled/disabled or visible. if you
turn off viewstate it has no way to know these values, but the browser posts
back the current value, so thats always maintained.

the list box has a list of values which it needs regenerate on postback for
to set the selected item based on the postback value. these are stored in
the viewstate. if you run the listbox withour viewstate you must reload the
valuelist in your code in OnInit (before the process postback data event).
otherwise when it gets the postback data, there is no item to select.

-- bruce (sqlwork.com)

"fabrice" <em******@test. com> wrote in message
news:Oz******** ******@TK2MSFTN GP10.phx.gbl...
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="frmSearchBr e4" runat="Server">

<asp:textbox id="myID" TabIndex="1" EnableViewState ="false" MaxLength="50"
runat="server" TextMode="Singl eLine">
</asp:textbox>

<asp:ListBox Width="200" Font-Size="10" Font-Name="Arial" id="myid2"
rows="4" Enabled="true"
EnableViewState ="false" runat="server">
</asp:ListBox>

</form>
In my web.config :

<pages buffer="true"
enableSessionSt ate="true"
enableViewState Mac="true"
validateRequest ="true"
autoEventWireup ="true">
</pages>
But when the page is a "postbak" the value of th TextBox control is
maintained. Not in the listBox control (it's right)...I don't know why...
Have you got an explanation ?

Thanks a lot
fabrice

Nov 19 '05 #2
thanks

"Bruce Barker" <br************ ******@safeco.c om> a écrit dans le message de
news: %2************* ***@TK2MSFTNGP1 1.phx.gbl...
the textbox uses viewstate to store the previous value so it can fire the
text changed event, whether its set enabled/disabled or visible. if you
turn off viewstate it has no way to know these values, but the browser
posts back the current value, so thats always maintained.

the list box has a list of values which it needs regenerate on postback
for to set the selected item based on the postback value. these are stored
in the viewstate. if you run the listbox withour viewstate you must reload
the valuelist in your code in OnInit (before the process postback data
event). otherwise when it gets the postback data, there is no item to
select.

-- bruce (sqlwork.com)

"fabrice" <em******@test. com> wrote in message
news:Oz******** ******@TK2MSFTN GP10.phx.gbl...
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="frmSearchBr e4" runat="Server">

<asp:textbox id="myID" TabIndex="1" EnableViewState ="false"
MaxLength="50" runat="server" TextMode="Singl eLine">
</asp:textbox>

<asp:ListBox Width="200" Font-Size="10" Font-Name="Arial" id="myid2"
rows="4" Enabled="true"
EnableViewState ="false" runat="server">
</asp:ListBox>

</form>
In my web.config :

<pages buffer="true"
enableSessionSt ate="true"
enableViewState Mac="true"
validateRequest ="true"
autoEventWireup ="true">
</pages>
But when the page is a "postbak" the value of th TextBox control is
maintained. Not in the listBox control (it's right)...I don't know why...
Have you got an explanation ?

Thanks a lot
fabrice


Nov 19 '05 #3

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

Similar topics

6
7875
by: Alex | last post by:
I am a newbie to ASP.NET... What I was trying to do... but yet to succeed in... I am building a customer info database... and on default, I want to display the customer's basic information in the TextBox on Page_Load... but, also allow user to update the information For example: Street1 of the home address
2
8387
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when submitting the form to update the database. The server doesn't have the client side value any more. It seems to me that as I begin to write the client side javacript code for form validation and client side editing capabilities in order to save...
2
3904
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...
2
1617
by: Gary Vidal | last post by:
I have a shopping cart webpage that shows a product and the Quantity they would like to order: When you click the link I want to take the quantity that they entered in the textbox and post that to the next page. But it keeps the original quantity I added to the viewstate. Where can i code this to post the correct quantity. Here is the code-behind I use. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)...
4
3569
by: Gill Smith | last post by:
After setting the web control text box enable property to FALSE makes the control to loose the data between round trip. I am making sure that the property - EnableViewState = TRUE. Same code when the text box Enable property set to TRUE retains the value. Please advice. -Gill
6
4734
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:
2
1587
by: PJ6 | last post by:
I have a textbox control where OnKeyPress of Enter, a few hidden field values are set and then form is submitted from JavaScript. The page reloads, and this textbox is then repopulated with data that may be different than what the user just entered. Well, I'm having a problem with this textbox getting its value set after the page Load event to the text the user just entered - even when I've explicitly disabled ViewState! I found a way...
2
4230
by: Andy Fish | last post by:
Hi, I have a forrm with viewstate disabled (to try and optimize network performance). I have come a bit unstuck though when I use a repeater with a textbox inside it Obivously with viewstate disabled, the repeater contains no items on postback unless I databind it. however, this causes the posted textbox values to be overwritten with the databound ones.
1
2096
by: Wilson | last post by:
Hi, Would you give me a idea how to create a web control with two Textbox ? my code : namespace com.index.web.components {
0
8403
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
8316
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
8833
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
8737
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...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
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...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.