Quantcast
Viewing latest article 10
Browse Latest Browse All 10

How to determine if the request is partial or full postback in asp.net


Sometimes, it is necessary to know if the page was requested through AJAX (partial) or full postback.

To determine which types of request has been made, you have to access the “ScriptManager”, to do this,

protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
if (ScriptManager.GetCurrent(this.Page).IsInAsyncPostBack)
{
// partial (asynchronous) postback occured
// insert Ajax custom logic here
}
else
{
// regular full page postback occured
// custom logic accordingly
}
}
}


Viewing latest article 10
Browse Latest Browse All 10

Trending Articles