A basic C# ASP.net page has a single RadGrid on a page. A RadButton with AutoPostBack=false has an OnClientClicked client-side handler function assigned. This function does some long operations, so I would like to show the AjaxLoadingPanel while the browser is busy, even though there isn't any actual Ajax retrievalgoing on. But it seems as if the OnClientClicked event somehow disables or defers the call to the show method of the AjaxLoadingPanel. The panel and spinner does show up, but only after the long client-side operations are complete. Is this by design? Is there an easy work-around?
A demo ASP setup:
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
></
telerik:RadScriptManager
>
<
div
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Skin
=
"Default"
></
telerik:RadAjaxLoadingPanel
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
AutoPostBack
=
"false"
Text
=
"Turn Loading Panel on"
OnClientClicked
=
"click_handler"
></
telerik:RadButton
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
DataSourceID
=
"demoinfo"
>
<
MasterTableView
>
<
Columns
></
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:XmlDataSource
runat
=
"server"
ID
=
"demoinfo"
datafile
=
"demoinfo.xml"
/>
</
div
>
<
p
id
=
"bar"
style
=
"background-color:black; display:inline; width:1px;"
>.</
p
>
</
form
>
<
script
>
function click_handler() {
loaderOn();
superslow();
//loaderOff();
}
function superslow() { //just a bunch of uselessness to simulate slow operations
var imax = 100000;
for (var i = 0 ; i <
imax
; i++) {
var noid = $find(i.toString().trim() + "id");
var
barel
=
document
.getElementById("bar");
barel.style.width
=
Math
.floor(i * (imax / 10)).toString() + "px";
if (i % 10000 == 0) {
console.log("ten thousand more...");
}
}
}
function loaderOn() {
lp = $find("RadAjaxLoadingPanel1")
lp.show("RadGrid1");
}
function loaderOff() {
lp = $find("RadAjaxLoadingPanel1")
lp.hide("RadGrid1");
}
</script>
Thanks for your help,
Justin