How can we make this article: http://www.telerik.com/help/aspnet-ajax/ajxshowloadingpanelnexttoajaxinitiator.html work when using master pages. I placed the code in the linked document in my master page. I surrounded the javascript with radcodeblock markup and changed the 1st line of the javascript to get the client id since i would be calling from a page using a masterpage.
var divElementStyle = document.getElementById('<%= RadAjaxLoadingPanel1.ClientID %>').style;
divElementStyle is populated correctly and i can see all of the styles applied to the loading panel.
When the function gets to:
divElementStyle.left = eventArgs.get_eventTargetElement().offsetLeft + "px";
the get_eventTargetElement failes with the exception "Object Required". I searched the support site for get_eventTargetElement and could not find any additional information. Can anyone provide a workaround?
6 Answers, 1 is accepted
0
Hello KevinMc,
Could you please elaborate a little bit more on your scenario? Does the Ajax initiator placed on the MasterPage or you are getting reference to it? Also does the LoadingPanel placed on the MasterPage? More information on your scenario will help us to provide accurate solution for this issue.
Sincerely yours,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Could you please elaborate a little bit more on your scenario? Does the Ajax initiator placed on the MasterPage or you are getting reference to it? Also does the LoadingPanel placed on the MasterPage? More information on your scenario will help us to provide accurate solution for this issue.
Sincerely yours,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
KevinMc
Top achievements
Rank 1
answered on 29 Oct 2008, 03:13 PM
In Master page:
Loading Panel
ScriptManager
AjaxManager
Javascript from article with RadCodeBlock wrapper and ClientID call for the Loading panel.
function RequestStart(sender, eventArgs) | |
{ | |
var divElementStyle = document.getElementById('<%= RadAjaxLoadingPanel1.ClientID %>').style; | |
divElementStyle.position = 'absolute'; | |
//position the loading panel | |
divElementStyle.left = eventArgs.get_eventTargetElement().offsetLeft + "px"; | |
divElementStyle.top = eventArgs.get_eventTargetElement().offsetTop + "px"; | |
} | |
The initiator(a radgrid) in the case i am testing is in the content page. I am guessing that i need to do something different in the javascript to get a reference to it? get_EventTargetElement is not able to return/ find an element in the contentpane / content page? I also have controls on the master page that I would like to be initiators. How do i handle both scenarios?
0
Hello KevinMc,
If the element in the content page is added as Ajax initiator for the RadAjaxManager on the MasterPage you should able to find it by get_EventTargetElement. How have you set the RadGrid from the content page to be ajax initiator using the RadAjaxManager?
Kind regards,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
If the element in the content page is added as Ajax initiator for the RadAjaxManager on the MasterPage you should able to find it by get_EventTargetElement. How have you set the RadGrid from the content page to be ajax initiator using the RadAjaxManager?
Kind regards,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
KevinMc
Top achievements
Rank 1
answered on 30 Oct 2008, 02:00 PM
Could you elaborate? The Grid i am using in this example is in the ajaxsettings of the radajaxmanager proxy on the content page. So how specifically do i set it to be an ajax initiator for the ajaxmanager on the master page?
0
Accepted
Hi KevinMc,
In this scenario a possible approach is to use the "FindControl" method in order to get reference to the RadGrid control. After that you could programatically add the Ajax settings and set the RadGrid control as Ajax initiatotr.
Greetings,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
In this scenario a possible approach is to use the "FindControl" method in order to get reference to the RadGrid control. After that you could programatically add the Ajax settings and set the RadGrid control as Ajax initiatotr.
A good example for similar implemetation is shown in the following help topic.Greetings,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
KevinMc
Top achievements
Rank 1
answered on 31 Oct 2008, 01:01 PM
Thanks, That would work. But i was hoping for a more generic approach. I would have to add an ajaxsetting to the master ajaxmanager for every page that had ajax and every initiator on the page. I will just stick with screen centering of the loading panel for now.