473,511 Members | 16,260 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New to ASP.NET - A very basic question regarding the ViewState and Server Round Trips

Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody please
explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to write a
text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is loaded
everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh
Nov 19 '05 #1
6 1745
This isnt' an ASP.Net thing...it's how most browsers behave...go to
www.google.com, enter some text and hit f5/reload...the text will stay...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody please
explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to write
a text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is loaded
everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh

Nov 19 '05 #2
Hi Karl,

I tried doing this in google.com and everytime I refresh I am getting a
fresh page back with no text.

This is what I am expecting in my ASP.NET app but is not happening.

Thanks
Anand
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:e7**************@tk2msftngp13.phx.gbl...
This isnt' an ASP.Net thing...it's how most browsers behave...go to
www.google.com, enter some text and hit f5/reload...the text will stay...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody please
explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to write
a text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is
loaded everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh


Nov 19 '05 #3
Textboxes don't use viewstate to store their text property.
This is handled by standard HTML.
If you want to clear the textbox then use code like this:
MyTextBox.Text = ""

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody please
explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to write
a text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is loaded
everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh

Nov 19 '05 #4
Steve,

Thanks for the info.

Here is what I observed in my ASP.NET application.

Observation 1:
Every time I do refresh (ctrl-F5) even if I add a text in my text box it is
cleared and whenever I do refresh I am geting fresh page with no text. So
this is exactly what I am expecting.
Observation 2:
When I click once on the ASP:Button which is on my page, then the page is
not loading but only the Postback event is happening. So during this
Postback event whatever Text info I used for the First Submit always stays
in my text box. Even if I change the value latter and then do a refresh
whatever Text Info I used for the First Submit stays in the text box.

So my question is

What is happening during the "ASP:Button" click event?

I thought it makes a round trip to server and behave same as the initial
page load event but it is not like that.

Can you please clarify?

Thanks
Anand Ganesh


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eB**************@TK2MSFTNGP15.phx.gbl...
Textboxes don't use viewstate to store their text property.
This is handled by standard HTML.
If you want to clear the textbox then use code like this:
MyTextBox.Text = ""

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody please
explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to write
a text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is
loaded everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh


Nov 19 '05 #5
The value of the textbox is being posted back to the page upon each
postback.
This is standard HTML functionality and is not related to ASP.NET.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Ok**************@TK2MSFTNGP10.phx.gbl...
Steve,

Thanks for the info.

Here is what I observed in my ASP.NET application.

Observation 1:
Every time I do refresh (ctrl-F5) even if I add a text in my text box it
is cleared and whenever I do refresh I am geting fresh page with no text.
So this is exactly what I am expecting.
Observation 2:
When I click once on the ASP:Button which is on my page, then the page is
not loading but only the Postback event is happening. So during this
Postback event whatever Text info I used for the First Submit always stays
in my text box. Even if I change the value latter and then do a refresh
whatever Text Info I used for the First Submit stays in the text box.

So my question is

What is happening during the "ASP:Button" click event?

I thought it makes a round trip to server and behave same as the initial
page load event but it is not like that.

Can you please clarify?

Thanks
Anand Ganesh


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eB**************@TK2MSFTNGP15.phx.gbl...
Textboxes don't use viewstate to store their text property.
This is handled by standard HTML.
If you want to clear the textbox then use code like this:
MyTextBox.Text = ""

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody
please explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to
write a text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is
loaded everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh



Nov 19 '05 #6
The value of the textbox is being posted back to the page upon each
postback.
This is standard HTML functionality and is not related to ASP.NET.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Ok**************@TK2MSFTNGP10.phx.gbl...
Steve,

Thanks for the info.

Here is what I observed in my ASP.NET application.

Observation 1:
Every time I do refresh (ctrl-F5) even if I add a text in my text box it
is cleared and whenever I do refresh I am geting fresh page with no text.
So this is exactly what I am expecting.
Observation 2:
When I click once on the ASP:Button which is on my page, then the page is
not loading but only the Postback event is happening. So during this
Postback event whatever Text info I used for the First Submit always stays
in my text box. Even if I change the value latter and then do a refresh
whatever Text Info I used for the First Submit stays in the text box.

So my question is

What is happening during the "ASP:Button" click event?

I thought it makes a round trip to server and behave same as the initial
page load event but it is not like that.

Can you please clarify?

Thanks
Anand Ganesh


"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eB**************@TK2MSFTNGP15.phx.gbl...
Textboxes don't use viewstate to store their text property.
This is handled by standard HTML.
If you want to clear the textbox then use code like this:
MyTextBox.Text = ""

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"msnews.microsoft.com" <ag*****@nobel-systems.com> wrote in message
news:Oc**************@TK2MSFTNGP14.phx.gbl...
Hello All,

I am very new to ASP.NET and I have a basic question. Can somebody
please explain?

I have an .aspx Web Page with a textbox control.

When the Page initially loads I am calling a Javascript function to
write a text information in the text box.

After that when I refresh the Page, I was hoping the information in the
textbox will be lost. But it stays.

I thought the 'EnableViewState' is set to 'True' and I made it 'False'.

Then when I refresh the page still my text stays in the TextBox.

This is confusing me.

I thought WebPages make round trips to server and hence new page is
loaded everytime. But how is my text still staying the text box?

Any suggestion?

Thanks for your time.

Regards
Anand Ganesh



Nov 19 '05 #7

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

Similar topics

2
8374
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...
3
2629
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
3
1684
by: Ohad Young | last post by:
Hi, I have a frameset page that contains two frames: 1. the first frame, an aspx page, contains a menu for navigating in the website. 2. the second frame contains content, pdf, html or other...
0
1564
by: Luis Esteban Valencia | last post by:
have a problem and I'm not sure how to handle/fix it. I have three listboxes on my page. The first listbox has a list of software products. When you select an item in the Products listbox, then...
3
3299
by: WhoopDing | last post by:
Why does my viewstate not seem to have an effect after the first server roundtrip?
3
3476
by: Gummy | last post by:
Hello, I have an ASPX page on which I place a UserControl 15 times (they only need to be static controls on the page). This UserControl is a set of two listboxes with radiobuttons above the...
1
3633
by: Iwan Petrow | last post by:
Hi, I do this - take some data with sqldataadaptor (at this moment 2000rows) in fill datatable. For each two rows do some calculations and save data to the database with insert command. (the...
7
3350
by: Tony Girgenti | last post by:
Hello. I'm trying to undetrstand ASP.NET 2.0 and javascript. When i have a button and i click on it and i see the web broswer progress bar at the bottom do something, does that mean that there...
2
12210
by: qwedster | last post by:
Folks! The following is a "Hello World" kind of code for ViewState. I just want to know how to retain the ViewState 1) while Page Refresh when using UpdatePanel and also 2) While I reverting back...
0
7242
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,...
0
7353
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,...
0
7418
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...
1
7075
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...
0
7508
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...
0
5662
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,...
1
5063
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...
0
3222
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...
0
446
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...

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.