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

update radgrid

6 Answers 126 Views
Window
This is a migrated thread and some comments may be shown as answers.
Renato Lopes
Top achievements
Rank 1
Renato Lopes asked on 17 Jul 2008, 02:34 PM
Hi.

I'm trying to update a radgrid on my page1 after I close a radwindow containing page2 but I'm having some trouble. I attached my project. Can you help me?

Thanks in advance

6 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 18 Jul 2008, 02:03 PM
Hi Renato,

Thank you for the provided project, but I deleted the link because the project contained a dev version of Telerik.Web.UI.dll and was available in the forum. Please, in the future in case you want to provide a project with a dev dll, open a new support ticket and attach it there.

I examined the project but I did not find the code which updates the grid there. I suggest to use the RadAjaxManager control in order to achieve the desired functionality, as shown in this online demo which shows the desired scenario.

The RadAjaxManager should have the following setting:

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">  
                <AjaxSettings> 
                    <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">  
                        <UpdatedControls> 
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                        </UpdatedControls> 
                    </telerik:AjaxSetting>   
                    </AjaxSettings> 
            </telerik:RadAjaxManager> 
 

The function, which refreshes the grid is the following:

   function refreshGrid(arg)  
            {  
             if(!arg)  
             {  
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");               
                }  
                else 
                {  
             $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");               
                }  
            }  
 

and it is called from within the RadWindow (by referencing its parent page).

The server handler for the ajax request is this one:

 protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)  
        {  
            if (e.Argument == "Rebind")  
            {  
                RadGrid1.MasterTableView.SortExpressions.Clear();  
                RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                RadGrid1.Rebind();  
            }  
            else if (e.Argument == "RebindAndNavigate")  
            {  
                RadGrid1.MasterTableView.SortExpressions.Clear();  
                RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;  
                RadGrid1.Rebind();  
            }  
        }  
 

You also have the full source code of the demo on your local disk because when you install RadControls, our online examples projects are automatically installed on your computer.

You can open the demos from here:

Start\Programs\Telerik\RadControls for ASPNET AJAX\Open Sample WebSite In VisualStudio

The actual location on your hard disk is the following one:

C:\Program Files\Telerik\RadControls for ASPNET AJAX Q1 2008\Live Demos

In case you still experience problems, please open a new support ticket and attach your project there along with a sample database and the needed connections to it.



Regards,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mike
Top achievements
Rank 1
answered on 21 Jul 2008, 08:41 PM
Is this the example you re referencing? 
 
C:\Program Files\Telerik\RadControls for ASPNET AJAX Q2 2008\Live Demos\Controls\Examples\Integration\GridAndWindow


0
Tervel
Telerik team
answered on 22 Jul 2008, 06:48 AM
Hello Mike,

That is correct. This is the example that was discussed.


Greetings,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Charles
Top achievements
Rank 1
answered on 14 May 2009, 06:44 PM
I have a twist to the navigation after refresh; I have a grid that gets updated from a radwindow however the user may have filtered the view via the item command using alpha paging (all members whos last name starts with "c") and paged the result to another page (i.e. page 3 of 5) for that result set. How do i get back to that particular members record after update and refresh of grid data?

Thanks in advance
0
Yavor
Telerik team
answered on 18 May 2009, 10:59 AM
Hello Charles,

You can keep track of which command is fired by attaching to the ItemCommand event handler of the control. Then if the user navigates to another page, you can store the old/new page index in session/viewstate. Then, after the user is done updating an item, you can reset the .currentPageIndex for the control, to navigate to the original page.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Charles
Top achievements
Rank 1
answered on 18 May 2009, 02:47 PM
Got it, works great. Thanks for your help...
Tags
Window
Asked by
Renato Lopes
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Mike
Top achievements
Rank 1
Tervel
Telerik team
Charles
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or