Brad Bridges
Top achievements
Rank 1
Brad Bridges
asked on 08 Dec 2009, 04:14 PM
Okay, this is what is going on and I will try to include as much detail as possible. Unfortunately, based on how our development API works I won't be able to post all the code and I realize that could make this hard to figure out. Here is the situation, we are using radajaxpanels in some places and radajaxmanager in others. In an application we create for sharepoint ajax works perfectly in webparts ajax does not work right until after a postback occurs. IE I have a group of controls in an radajaxpanel, setup to ajaxify everything in the control. When I click on a button inside the panel I get a full postback. Afterwhich, if I click on the same button the ajax portion of it works from then on. Doesn't matter if it's the radajaxpanel or the ajaxmanager, both act the sameway. However, ajax toolkit update panel works correctly. We do all of our web parts in user controls and if we add that user control to a non-webpart the ajax works fine. So, it has to be an issue between sharepoint and the ajax functionality.
We have a script manager and ajax manager being added to the page on preinit. We also have safescriptmanagers on every user control (this is what fixed the ajax toolkit update panel), but not matter what we have tried we cannot get rad ajax to fire on the first shot. However, other RAD controls that are ajaxified work fine, it's just the update panels that are not working.
Any help would be greatly appreciated.
Thanks!
We have a script manager and ajax manager being added to the page on preinit. We also have safescriptmanagers on every user control (this is what fixed the ajax toolkit update panel), but not matter what we have tried we cannot get rad ajax to fire on the first shot. However, other RAD controls that are ajaxified work fine, it's just the update panels that are not working.
Any help would be greatly appreciated.
Thanks!
9 Answers, 1 is accepted
0
Hello Brad,
In cases like yours, where a UserControl is added dynamically to the page, it is recommended that you add the AjaxSettings programmatically (using RadAjaxManager) on UserControl's PreRender event. This way you will ensure that all of the ajaxified controls are added to the page's controls collection and can be updated appropriately.
Kind regards,
Rosen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
In cases like yours, where a UserControl is added dynamically to the page, it is recommended that you add the AjaxSettings programmatically (using RadAjaxManager) on UserControl's PreRender event. This way you will ensure that all of the ajaxified controls are added to the page's controls collection and can be updated appropriately.
Kind regards,
Rosen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brad Bridges
Top achievements
Rank 1
answered on 15 Dec 2009, 02:05 PM
Well, I haven't even got to test this in sharepoint yet. However, after doing this programmatically the loading panel no longer works. The ajax still works as expected. The brief test in moss the same problem as above still happens and the loading panel does not work there either. I am still trying to come up with reasons why it won't render the loading panel when the ajax settings are added via code. This even occurs in my test version of the control with no sharepoint interaction.
That is what I am doing in prerender. I have also tried to use a loading panel that is already on the page and I have tried setting the defaultloadingpanelid on the ajaxmanager.
-Brad
RadAjaxLoadingPanel loadingPanel = new RadAjaxLoadingPanel(); |
loadingPanel.Skin = "Default"; |
this._ajaxManager.AjaxSettings.AddAjaxSetting(btnSearch, gridResults, loadingPanel); |
That is what I am doing in prerender. I have also tried to use a loading panel that is already on the page and I have tried setting the defaultloadingpanelid on the ajaxmanager.
-Brad
0
Brad,
Can you please try add the RadAjaxLoadingPanel to the UserControl's/Page's controls collection as it seems that this is missing from the pasted code snippet.
Greetings,
Rosen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Can you please try add the RadAjaxLoadingPanel to the UserControl's/Page's controls collection as it seems that this is missing from the pasted code snippet.
Greetings,
Rosen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Brad Bridges
Top achievements
Rank 1
answered on 15 Dec 2009, 03:59 PM
Okay,
I added it to the user control's control library via this.controls.Add(). However, the loading panel still does not show. I also added it to the ascx and referenced that one, same problem no loading panel.
I also updated to the latest and greatest version of radajax. Still no go. After the upgrade I tried using the radajaxmanagerproxy once again rather than a full out manager. We have a base class for all of our controls/pages/webparts that generates an instance of script manager and ajax manager, so this is why we started with using a proxy rather than a full manager. In testing the control the loading panel/ajax worked fine. However, once in sharepoint the same problem as always the first post back is not ajaxified, but all postbacks after that are. I compared the two source files between the first postback and the second there were some webresource scripts not included and also there was no javascript to declare the ajax calls. It definitely appears to just not be adding it in until after it posts back one time.
Thanks,
Brad
I added it to the user control's control library via this.controls.Add(). However, the loading panel still does not show. I also added it to the ascx and referenced that one, same problem no loading panel.
I also updated to the latest and greatest version of radajax. Still no go. After the upgrade I tried using the radajaxmanagerproxy once again rather than a full out manager. We have a base class for all of our controls/pages/webparts that generates an instance of script manager and ajax manager, so this is why we started with using a proxy rather than a full manager. In testing the control the loading panel/ajax worked fine. However, once in sharepoint the same problem as always the first post back is not ajaxified, but all postbacks after that are. I compared the two source files between the first postback and the second there were some webresource scripts not included and also there was no javascript to declare the ajax calls. It definitely appears to just not be adding it in until after it posts back one time.
Thanks,
Brad
0
Brad Bridges
Top achievements
Rank 1
answered on 15 Dec 2009, 04:56 PM
This is getting fun. I added the ajaxmanagerproxy back. I added the ajaxsettings in the designer AND via code behind. Now the loading panel works and it appears to be ajaxified on the first load, but the grid never updates. However, I do feel this is getting closer. I will continue to test things unless someone has a better idea.
-Brad
-Brad
0
Brad Bridges
Top achievements
Rank 1
answered on 15 Dec 2009, 07:18 PM
Well, I am stuck now. I am now getting the dreaded error:
Error: [Exception... "'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An item with the same key has already been added.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]
Even though I have placed the Javascript in that is supposed to fix this problem. (Already had it there from previous ajax issues we have had.) So, after googling and googling I still haven't got it to work.
-Brad
Error: [Exception... "'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An item with the same key has already been added.' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)" location: "<unknown>" data: no]
Even though I have placed the Javascript in that is supposed to fix this problem. (Already had it there from previous ajax issues we have had.) So, after googling and googling I still haven't got it to work.
-Brad
0
Brad Bridges
Top achievements
Rank 1
answered on 15 Dec 2009, 07:25 PM
Okay. I have this entirely fixed now. The lesson I learned A) ALWAYS approve pages in sharepoint they make javascript act funny when they aren't. B) The radajaxproxy WOULD not work for me. I had to assign the ajaxsettings to actual instance of the radajaxmanager. C) Do this on the prerender event. I now have it entirely working. Thank you so much for your help.
0
Ronak
Top achievements
Rank 1
answered on 12 Oct 2010, 02:19 PM
Hi Brad,
I am working with Telerik control on sharepoint 2010 Platform and i have created a Visual webpart meaning User control webpart.
in WebPart there is Radlistview which display data from page library and also have raddatapager for paging.
Now i had same issue like you In all browser except IE it do full postback first then partial postback and also i cant get loading panel work.
second thing in IE i am getting 404 error when try to change page size or try to navigate second page but when back button in browser after 404 it works fine selected pagesize but again if i change will get 404.
I have Radajaxmanager control in masterPage and i used RadAjaxProxy in .ascx file i also tried with Ajaxpanel and AjaxManager on .ascx file it self naver worked
can you please share your exp.....
Ronak
I am working with Telerik control on sharepoint 2010 Platform and i have created a Visual webpart meaning User control webpart.
in WebPart there is Radlistview which display data from page library and also have raddatapager for paging.
Now i had same issue like you In all browser except IE it do full postback first then partial postback and also i cant get loading panel work.
second thing in IE i am getting 404 error when try to change page size or try to navigate second page but when back button in browser after 404 it works fine selected pagesize but again if i change will get 404.
I have Radajaxmanager control in masterPage and i used RadAjaxProxy in .ascx file i also tried with Ajaxpanel and AjaxManager on .ascx file it self naver worked
can you please share your exp.....
Ronak
0
Brad Bridges
Top achievements
Rank 1
answered on 11 Nov 2010, 01:34 PM
Unfortunately, I haven't done any development in 2010 yet. However, what I was encountering doesn't sound like the same problem. However, I can say that when I tested my code in 2010 (just deployed features I have for 2007) it all seemed to work correctly.
-Brad
-Brad