Thursday 23 January 2014

check postback in asp.net using javascript

read our previous articles how-to-disable-back-button-in-browser  and prevent-page-refresh-on-button-click-in-asp.net

  
<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>Untitled Page</title>

    <script type="text/javascript">
var check = <%= Page.IsPostBack ? "1" : "0" %>;
if(check==1)
{
alert("PostBack window");
}
else
{
alert("first window");
}
</script>
</head>
<body>
    <form id="form1" runat="server"  >
    <div>
  This exaple to check posback in asp.net c#


        <asp:Button ID="Button1" runat="server" Text="Button" />

    </div>

    </form>

</body>

</html>

run code and view action ...

0 comments:

Post a Comment