I have very little knowledge of Java Script but I am trying to call Java Script Functions. I realize that I cannot call
JS from code behind and therefore using
OnClientClick.
Mark up:
<scripttype="JavaScript">
var Page;
var postBackElement;
function pageLoad()
{
Page = Sys.WebForms.PageRequestManager.getInstance();
Page.add_beginRequest(OnBeginRequest);
Page.add_endRequest(endRequest);
}
function OnBeginRequest(sender, args)
{
$get("IMGDIV").style.display="";
}
function endRequest(sender, args)
{
$get("IMGDIV").style.display="none";
}
</script>
</head>
<body>
<formid="form1"runat="server">
<divid="IMGDIV"style="display:none;position:absolute;left: 35%;top: 25%;vertical-align:middle;border-style:inset;border-color:black;background-color:White;z-index:103;">
<asp:ImageID="Image1"runat="server"ImageUrl="~/ajax-loader.gif"/>
<asp:LabelID="Label1"runat="server"Text="Loading...."/>
</div>
<asp:ButtonID="Button1"runat="server"Text="Button"OnClientClick="OnBeginRequest();"style="z-index: 100; left: 20px; position: absolute; top: 235px"/>
<asp:ButtonID="Button2"runat="server"Text="Button"OnClientClick="endRequest();"Style="z-index: 104; left: 163px; position: absolute; top: 234px"Text="Button"/>