Sharepoint 2007 Ajax Issues

10 posts, 0 answers
  1. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 08 Dec 2009 Link to this post

    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!
  2. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 11 Dec 2009 Link to this post

    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.
  3. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 15 Dec 2009 Link to this post

    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.

     
                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
  4. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 15 Dec 2009 Link to this post

    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.
  5. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 15 Dec 2009 Link to this post

    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
  6. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 15 Dec 2009 Link to this post

    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
  7. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 15 Dec 2009 Link to this post

    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
  8. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 15 Dec 2009 Link to this post

    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.


  9. Ronak
    Ronak avatar
    108 posts
    Member since:
    Sep 2010

    Posted 12 Oct 2010 Link to this post

    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
  10. Brad Bridges
    Brad Bridges avatar
    7 posts
    Member since:
    Oct 2008

    Posted 11 Nov 2010 Link to this post

    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
Back to Top