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

How to refresh UserControl Grid when RadAjaxManager is on MasterPage?

1 Answer 210 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Masterdom5
Top achievements
Rank 1
Masterdom5 asked on 01 Sep 2011, 04:38 PM
Hi,

1)   I have a master page that contains the following controls:
      <telerik:RadAjaxManager id="RadAjaxManager" runat="server" EnablePageMethods="True" />
      <telerik:RadAjaxLoadingPanel id="DefaultLoadingPanel" runat="server" />

2)   My content page contains:
      <telerik:RadPanelItem Value="CourseControl" Text="Courses"><ContentTemplate>...</ContentTemplate></telerik:RadPanelItem>
      <telerik:RadAjaxManagerProxy id="CourseRadAjaxManagerProxy" runat="server">
         <AjaxSettings>
          <telerik:AjaxSetting AjaxControlID="CourseGrid">
           <UpdateControls>
            <telerik:AjaxUpdateControl ControlID="CourseGrid" LoadingPanelID="DefaultLoadingPanel" />
           </UpdateControls>
          </telerik:AjaxSetting>
         </AjaxSettings>
      </telerik:RadAjaxManagerProxy>

3)   My User Control known as CourseControl in the above RadPanelItem contains the following control:
       <UC1:CourseGrid id="CourseGridControl" runat="server">

4)   My CourseGrid user control which is a generic grid used by multiple user controls has a Javascript function to open a popup window (AddEditCourse.aspx) which helps users manage the courses.
 
The problem is when a new course is added to the database or an existing course is updated I am unable to refresh the grid so that the changes be visible to the user. In the CloseAndRebind() function located in the popup window, I use top.location.href = top.location.href. This refreshes the grid but it refreshes the entire page while I only want to refresh only the grid.

Complete Root: MasterPage->Couses.aspx->CoursesUC.ascx->CourseGrid.ascx->AddEditCourse.aspx

Can someone please point me in the right direction? I would appreciate if you could provide me some code sample.

Thank you in advance.

Luc

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 06 Sep 2011, 03:47 PM
Hi,

You could add ajax settings programmatically for this scenario - if you are rebinding the grid firing an ajax request from the client, you need a setting where the ajax manager updates the grid. If the grid is initiating the postback , you need a setting where it updates itself. You can see how programmatic settings can be created here:
Add AjaxSettings programmatically

You can access the main ajax manager from every part of the page using its GetCurrent static method as shown here:
RadAjax and WebUserControls

Greetings,
Tsvetina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Masterdom5
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or