update radgrid

7 posts, 0 answers
  1. Renato Lopes
    Renato Lopes avatar
    13 posts
    Member since:
    Sep 2007

    Posted 17 Jul 2008 Link to this post

    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
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 Jul 2008 Link to this post

    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
  3. Mike
    Mike avatar
    338 posts
    Member since:
    Jun 2008

    Posted 21 Jul 2008 Link to this post

    Is this the example you re referencing? 
     
    C:\Program Files\Telerik\RadControls for ASPNET AJAX Q2 2008\Live Demos\Controls\Examples\Integration\GridAndWindow


  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 22 Jul 2008 Link to this post

    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
  5. Charles
    Charles avatar
    10 posts
    Member since:
    Jan 2009

    Posted 14 May 2009 Link to this post

    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
  6. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 18 May 2009 Link to this post

    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.
  7. Charles
    Charles avatar
    10 posts
    Member since:
    Jan 2009

    Posted 18 May 2009 Link to this post

    Got it, works great. Thanks for your help...
Back to Top