Tuesday, January 24, 2012

how to display a loading process image in asp.net functions

<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
function BeginRequestHandler(sender, args)
{
document.getElementById('<%= lblmsg.ClientID %>').style.display = 'none';

var state = document.getElementById('loadingdiv').style.display;
if (state == 'block') {
document.getElementById('loadingdiv').style.display = 'none';
} else {
document.getElementById('loadingdiv').style.display = 'block';
}
args.get_postBackElement().disabled = true;
}
</script>


<div id="loadingdiv" style="display:none; margin-left:5.3em">
<img src="icons/throbber_circle.gif" alt="Loading" /> Please wait...
</div>
<asp:Label ID="lblmsg" runat="server" ForeColor="Green"></asp:Label>

Sunday, January 1, 2012

how to set a linkbutton as default button in asp.net using javascript

txtPassword.Attributes.Add("onKeyPress", "javascript:if (event.keyCode == 13) __doPostBack('" + btnLogin.UniqueID + "','')");