472,982 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

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 1712
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
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
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
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
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
by: WhoopDing | last post by:
Why does my viewstate not seem to have an effect after the first server roundtrip?
3
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
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
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
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
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.