General

AJAX Tips

Some of you may know how to disable ajax updates on the ScriptManager tag directly..

<asp:ScriptManager ID=”ScriptManager1″ runat=”server” EnablePartialRendering=”false” />

But did you know that you can also disable ajax for a specific content page?

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
    ScriptManager.GetCurrent(this.Page).EnablePartialRendering = false;
}

If you want to find out if the page did an asynchronous postback or not, use this..

protected void Page_Load(object sender, EventArgs e)
{
    if (ScriptManager1.IsInAsyncPostBack)
    {
        Page.Title = "AJAX POSTBACK!";
    }
}