473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

postbacks

JJ
I know that this has been talked about before but I am still unsure.
When a asp.net page has a submit button clicked it sends the data in
the viewstate from controls on page to the server. The server sends a
response to same page with the same data. This is what is called a
postback, correct? A postback actually represents a round trip to and
back again from server, right? Now without the viewstate if I clicked
submit and the page didn't have viewstate enabled then the response
from the server would actually clear out the controls, correct?

Also what is HttpContext about? I read that it represents the data in
page, correct? When I reference this in code behind what are common
coding practices in using it?

Thanks,

JJ

Jul 4 '06 #1
2 1422
You're right about postback ... note that the values of the controls
are restored from the viewstate on the server ... then you can
manipulate them before the viewstate gets serialized again and the
controls get rendered to the browser.

One bit of advice: don't get postback crazy because it is expensive.
Don't use postback for navigation between pages. Just use it for
submitting forms. And check out the new Atlas framework for reducing
full page round trips.

I would check out msdn2.microsoft.com for stuff on HttpContext.

JJ wrote:
I know that this has been talked about before but I am still unsure.
When a asp.net page has a submit button clicked it sends the data in
the viewstate from controls on page to the server. The server sends a
response to same page with the same data. This is what is called a
postback, correct? A postback actually represents a round trip to and
back again from server, right? Now without the viewstate if I clicked
submit and the page didn't have viewstate enabled then the response
from the server would actually clear out the controls, correct?

Also what is HttpContext about? I read that it represents the data in
page, correct? When I reference this in code behind what are common
coding practices in using it?

Thanks,

JJ
Jul 4 '06 #2
I know that this has been talked about before but I am still unsure.
When a asp.net page has a submit button clicked it sends the data in
the viewstate from controls on page to the server. The server sends a
response to same page with the same data. This is what is called a
postback, correct? A postback actually represents a round trip to and
back again from server, right? Now without the viewstate if I clicked
submit and the page didn't have viewstate enabled then the response
from the server would actually clear out the controls, correct?

Also what is HttpContext about? I read that it represents the data in
page, correct? When I reference this in code behind what are common
coding practices in using it?

Thanks,

JJ
Data in textboxes is not sent to the server via viewstate.
If you generate the content of a Label (which might be an "expensive"
operation), then the value assigned to that Label is remembered in
ViewState. On a postback the value for that label is restored from
ViewState, so you don't need to calculate is again.

HttpContext represents the "context" this page is called in. One very
useful application: if you want to access the Session (or Request or
Response) from within some class-library project, you can't use the
Session (Request, Response) properties that regular pages have. Instead
you can use HttpContext.Current.Session (etc).
Some things to watch out for: if a method is called by a timer (for
instance), instead of as a result of some HttpRequest, then there is no
HttpContext. Also in some cases Session could be null.

Hans Kesting
Jul 4 '06 #3

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

Similar topics

5
by: Dave | last post by:
(Second Try) Greetings, I have an asp.net web application that utilizes a User Control at the top of the page. My User Control contains a Server Control menu which will require postbacks. ...
0
by: gregfocker | last post by:
I installed the new RTM version of ASP.NET 2.0 AJAX Extensions 1.0 released on Tuesday (1/23). I made the required changes to the web.config file to go from the RC version to the RTM version. ...
1
by: Kursat | last post by:
Hi, I have a question about Ajax postbacks : - Does ASP.NET process multiple UpdatePanel postbacks in single thread when two or more different update panel postbacks occur at the same time for...
4
by: Nathan Sokalski | last post by:
I have 2 private variables in my class that I need to remember the values of between postbacks (or actually callbacks, since I am using AJAX). I want to avoid using session variables, if possible....
4
by: Nathan Sokalski | last post by:
I have 2 private variables in my class that I need to remember the values of between postbacks (or actually callbacks, since I am using AJAX). I want to avoid using session variables, if possible....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...

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.