Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void LoadWaitingMessage()
- {
- LoadWaitingMessage(string.Empty);
- }
- protected void LoadWaitingMessage(string message)
- {
- var scriptManager = ScriptManager.GetCurrent(Page);
- if (scriptManager != null)
- scriptManager.Scripts.Add(new ScriptReference("/js/jquery.blockUI.js"));
- if (message == string.Empty) message = LocalizedText.WaitingText;
- var script = string.Format(@"$(document).ready(
- function () {{
- Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(onRequestStart);
- Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onRequestEnd);
- }});
- var timeout;
- function onRequestStart() {{
- timeout = setTimeout(function() {{
- $.blockUI({{ message: '{0}',
- css: {{
- border: 'none',
- padding: '15px',
- backgroundColor: '#000',
- '-webkit-border-radius': '10px',
- '-moz-border-radius': '10px',
- opacity: .5,
- color: '#fff'
- }}
- }});
- }}, 1500);
- }}
- function onRequestEnd() {{ clearTimeout(timeout); $.unblockUI(); }}", message);
- ScriptManager.RegisterStartupScript(this, GetType(), ClientID, script, true);
- }
Advertisement
Add Comment
Please, Sign In to add comment