Client side rebind on two grids in one method

4 posts, 0 answers
  1. lilleliz
    lilleliz avatar
    7 posts
    Member since:
    Dec 2006

    Posted 03 Aug 2010 Link to this post

    Hi I'm having a bit of a frustrating problem. I have to different grids in the same page and after an operation performed in a radwindow I want both of these grids rebinded. 

    the javascript method is straight forward:

    function OnClientClose(oWnd) {
                        var masterTable2 = $find("<%= SendingRadGrid.ClientID %>").get_masterTableView();
                        masterTable2.rebind();
                        var masterTable1 = $find("<%= OrderedRadGrid.ClientID %>").get_masterTableView();
                        masterTable1.rebind();
    }

    Both grids have a NeedDataSource method but strangely only the second one gets called. I actually tried to change the order and that changed which grid got rebinded. Seems like a bug to me. Any workarounds?
  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 06 Aug 2010 Link to this post

    Hello Lilleliz,

    Generally rebind() method will request the server (post-back or ajax request if the grid is ajaxified). The second rebind may not be able to reach the server. Such approach will be successful only if the grid data-binding is asynchronous - for example client-side data-binding.
    I suggest you to ajaxify your grids with RadAjaxManager and perform the required update as below:
    In OnClientClose function:
    $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest();

    In server side RadAjaxManager1_AjaxRequest event handler:
    protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
    {
          grid1.Rebind();         
          grid2.Rebind();
    }

    Thus you can rebind the grids in one call back.

    Sincerely yours,
    Radoslav
    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
  3. lilleliz
    lilleliz avatar
    7 posts
    Member since:
    Dec 2006

    Posted 06 Aug 2010 Link to this post

    Thanks for your help. That worked like a charm!

    Lilleliz
  4. Rebecca
    Rebecca avatar
    3 posts
    Member since:
    Jan 2012

    Posted 06 Feb 2018 Link to this post

    Wow, thanks, I was looking for the answer to this for ages. Perfect.
Back to Top