Hi
What is Ispostback Property in ASP.Net. Why do we use that. How can we use pointers in ASP.Net ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
MuthuMari MPosted May 14, 2012, 4:06 AM
Ispostback :
Gets a value that indicates whether the page is being rendered for the first time or is being loaded in response to a postback.
The following example shows how to test the value of the IsPostBack property when the page is loaded in order to determine whether the page is being rendered for the first time or is responding to a postback. If the page is being rendered for the first time, the code calls the Page.Validate method.
Pointers :
Pointers are variables that hold the addresses of other variables. For example, if x contains the address of y, then x is said to "point to" y. Once a pointer points to a variable, the value of that variable can be obtained or changed through the pointer.
Satyapriya NayakPosted May 13, 2012, 3:36 AM
IsPostBack property indicates that whether this is the first time user has requested fort the page or it is reloaded based on any response on postback.
This property checks for __VIEWSTATE or __EVENTTARGET parameter in Request object. if these parameters are absent that means it is requested for the first time and if these parameters are present then this request is not first request.
The page exposes the IsPostBack property. This is a read-only Boolean property that indicates if the page or control is being loaded for the first time, or if it is being loaded in response to a client postback. Many expensive operations (such as getting data from a database or populating ListItems) must be performed only the first time the page or control is loaded. If the page is posted to the server and then reloaded, there is no need to repeat the operation
Example 1. Testing for IsPostBack in VB.NET
sub Page_Load(ByVal Sender as Object, _
ByVal e as EventArgs)
if not IsPostBack then
' Do the expensive operations only the
' first time the page is loaded.
end if
end sub
Example 2. Testing for IsPostBack in C#
void Page_Load(Object sender, EventArgs e)
{
if (! IsPostBack)
{
// Do the expensive operations only the
// first time the page is loaded.
}
}
Thanks