Paging RadGrid inside RadXMLHttpPanel

4 posts, 0 answers
  1. Jaytee
    Jaytee avatar
    3 posts
    Member since:
    Nov 2009

    Posted 24 Nov 2009 Link to this post

    Hi all

    I was looking at the following demo and wanted to emulate something similar.

    I have a default.aspx page which has a RadAjaxPanel and a RadXMLHttpPanel contained within that in the vein of the demo, I have created a web user control which contains a RadGrid and when default.aspx loads I load the user control into the XMLHttpPanel. Unfortunately the paging of the RadGrid in my user control seems to go wrong. Unlike the demo above whereby only the RadGrid appears to update, I get the full postback and then my control disappears off the page.

    Any thoughts or has anybody done something similar with success?

    Many thanks in advance

  2. Pero
    Pero avatar
    1156 posts

    Posted 27 Nov 2009 Link to this post

    Hi Jaytee,

    Are you loading the UserControl by a partial page update using the RadXmlHttpPanel's client callback functionality? If so, the RadGrid will disappear when you try to change its page index or sort the records in a column, because the control is not recreated on every postback (or AJAX postback). When you dynamically create controls you need to make sure that they will be also recreated on each postback and that the ViewState will be loaded correctly. That is why my recommendation is to load and recreate the UserControl in the Page_Init event.

    In case this is not the problem, can you please put together a sample project where the problem can be observed and send it back? Once we receive it we will do our best to provide a working solution. 

    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. Vic
    Vic avatar
    20 posts
    Member since:
    Jun 2004

    Posted 30 Apr 2010 Link to this post

    I am loading a UserControl that contains a RadScheduler. It is loaded correctly but when I navigate (postback) to another day, it disappers.




    void TestRadXmlHttpPanel_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)





    as RadXmlHttpPanel).Controls.Add(LoadControl("~/UserControls/Calendar.ascx"));



  4. Pero
    Pero avatar
    1156 posts

    Posted 05 May 2010 Link to this post

    Hi Vic,

    This is expected behavior. The XmlHttpPanel uses ASP.NET client callbacks and web services to update its content. This means that there is no ViewState and the Controls tree is not created. Basically, the XmlHttpPanel retrieves the HTML content as a string, and pastes it on the client. If a postback occurs, the content will disappear - since it does not exist on the server.
    If you plan on using server-side events, that require page postbacks or Ajax calls, then you should switch to using Ajax Panel instead.

    More information about RadXmlHttpPanel can be found on our online documentation.

    Kind regards,
    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.
Back to Top