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

Paging RadGrid inside RadXMLHttpPanel

3 Answers 154 Views
XmlHttpPanel
This is a migrated thread and some comments may be shown as answers.
Jaytee
Top achievements
Rank 1
Jaytee asked on 24 Nov 2009, 03:13 PM
Hi all

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

http://demos.telerik.com/aspnet-ajax/xmlhttppanel/examples/gridinxmlhttppanel/defaultcs.aspx

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

3 Answers, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 27 Nov 2009, 12:40 PM
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. 


Greetings,
Pero
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
Vic
Top achievements
Rank 1
answered on 30 Apr 2010, 05:09 PM

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


protected

 

 

void TestRadXmlHttpPanel_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)

 

{

(sender

 

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

 

}

0
Pero
Telerik team
answered on 05 May 2010, 12:27 PM
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,
Pero
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
XmlHttpPanel
Asked by
Jaytee
Top achievements
Rank 1
Answers by
Pero
Telerik team
Vic
Top achievements
Rank 1
Share this question
or