Google Reviews
If you find this content or our services useful, please leave us a review.

This post describes how detect for ASP.Net page postback from Javascript.  I needed to know if it was the first launch of the page or a postback from Javascript.  I did this by adding a hidden field to the page:

<asp:HiddenField runat="server" ID="hdnIsPostback" />

In the page load event, I then set the value of this field to be the postback status:

protected void Page_Load(object sender, EventArgs e)
    //set our hidden field so we can get postback value in javascript
    hdnIsPostback.Value = Page.IsPostBack.ToString();

and then I could obtain the value (true or false) in Javascript/JQuery using the following:

if ($("#<%= hdnIsPostback.ClientID %>").val().toLowerCase() == "false") {



Detect for ASP.Net page postback from Javascript
Comments have now been disabled. If you have a question to ask about this post please ask the community!