Thursday, August 14, 2014

Check if page is PostBack in asp.net at the client side using Jquery

 

Design:

 
<script type="text/javascript">
    $(document).ready(function () { 
    //Check here if Page is postback and fire events accordingly.
    if (isPostBack){ 
 
     }
});  
</script>
 

Code Behind:


    protected void Page_Load(object sender, EventArgs e)
    {
        ClientScript.RegisterClientScriptBlock(GetType(), "IsPostBack",
                                                   IsPostBack ? "var isPostBack = true;" : "var isPostBack = false;",
                                                   true);
    }

No comments:

Post a Comment