This is a migrated thread and some comments may be shown as answers.

RadAjaxLoadingPanel is not appearing at the center of the page.

3 Answers 212 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
kalyan gupta
Top achievements
Rank 1
kalyan gupta asked on 21 Mar 2011, 04:48 PM
Hi @

I am using Telerik:RadAjaxLoadingPanel to display the loading image on the screen when ever there is an ajaxify postback.

Following is the code:

<

 

telerik:RadAjaxLoadingPanel ID="radLoadingPnl" runat="server" AnimationDuration="300"

 

 

Style="vertical-align: middle;" HorizontalAlign="Center" EnableSkinTransparency="true"

 

 

BackgroundPosition="Center">

 

 

<img alt="Loading..." src="Images/loading.gif" style="border: 0px; vertical-align: middle;"

 

 

align="middle" />

 

 

</telerik:RadAjaxLoadingPanel>

 



//For displaying loading screen.

 

var loadingPanel = "";

 

 

 

var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();

 

 

 

var postBackElement = "";

 

 

pageRequestManager.add_initializeRequest(initializeRequest);

 

pageRequestManager.add_endRequest(endRequest);

 

 

function initializeRequest(sender, eventArgs) {

 

 

loadingPanel = $find(

'<% = radLoadingPnl.ClientID %>');

 

 

postBackElement = eventArgs.get_postBackElement().id;

 

loadingPanel.show(postBackElement);

 

}

 

 

function endRequest(sender, eventArgs) {

 

 

loadingPanel = $find(

'<% = radLoadingPnl.ClientID %>');

 

 

loadingPanel.hide(postBackElement);

 

}



But My Loading Image always appear next to the control because of which Ajax postback occured instead of Center of the screen.

Is there any property by which I can display the Loading image in the center of the screen for all the resolutions and for all the Ajax postbacks.

Please suggest.

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 21 Mar 2011, 05:23 PM
Hi Kalyan,

The help article below demonstrates how to center the loading panel on the screen.
http://www.telerik.com/help/aspnet-ajax/ajax-center-loadingpanel.html

Give it a try and let me know how it goes.

Best wishes,
Pavlina
the Telerik team
0
kalyan gupta
Top achievements
Rank 1
answered on 11 Apr 2011, 08:02 AM
I have solved this with the following code

<script type="text/javascript">
            function centerLoadingPanel() {
                centerElementOnScreen($get("<%= radLoadingPnl.ClientID %>"));
            }
            function centerElementOnScreen(element) {
                var scrollTop = document.body.scrollTop;
                var scrollLeft = document.body.scrollLeft;
                var viewPortHeight = document.body.clientHeight;
                var viewPortWidth = document.body.clientWidth;
                if (document.compatMode == "CSS1Compat") {
                    viewPortHeight = document.documentElement.clientHeight;
                    viewPortWidth = document.documentElement.clientWidth;
                    if (!$telerik.isSafari) {
                        scrollTop = document.documentElement.scrollTop;
                        scrollLeft = document.documentElement.scrollLeft;
                    }
                }
                var topOffset = Math.ceil(viewPortHeight / 2 - element.offsetHeight / 2);
                var leftOffset = Math.ceil(viewPortWidth / 2 - element.offsetWidth / 2);
                var top = scrollTop + topOffset - 40;
                var left = scrollLeft + leftOffset - 70;
                element.style.position = "absolute";
                element.style.top = top + "px";
                element.style.left = left + "px";
            }
        </script>
0
Pavlina
Telerik team
answered on 11 Apr 2011, 12:13 PM
Hi Kalyan,

I am glad you managed to display the LoadingPanel in the center of the screen. However, please do not hesitate to contact us if other questions or problems arise.

Best wishes,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Ajax
Asked by
kalyan gupta
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
kalyan gupta
Top achievements
Rank 1
Share this question
or