0

I have a Telerik RadGrid and its columns are generated. The RadGrid is hierarchical and I have RadWindows where I can add/delete/modify dinamically columns to my grid and the RadGrid is refreshed when the RadWindow is closed.

My RadWindow:

    <telerik:RadWindow ID="RadWindow1" runat="server" KeepInScreenBounds="true" CssClass="Columns"
        Title="Manage Columns" OnClientClose="refreshGrid" EnableViewState="false"
        Width="740" Height="330">
    </telerik:RadWindow>

refreshGrid Javascript function:

     function refreshGrid(sender) {
            $find("<%= RadGrid1.ClientID %>").get_masterTableView().rebind();
            showScrollBars();
    }

This works if I add/modify/delete column(s) in the first level, but it doesn't work for Detail Tables. More exactly the detail tables are refreshed correctly on the server side, but it's not refreshed on client side. Does anybody know the cause of this problem?

I've found a page on the Telerik forum, but it didn't help:

http://www.telerik.com/community/forums/aspnet-ajax/grid/details-table-not-refreshed-in-spite-of-detailtabledatabind-is-fired.aspx

Any help/ advice is appreciated.

2 Answers 2

0

Are you using any form of Ajax on your page relating to the RadGrid? I guess, as pointed out in that forum thread, that there could be an issue with partial postbacks not necessarily updating the control as necessary. So, if you are using the RadAjaxManager I recommend going a bit overboard with which control updates the other controls on the page and then go backwards (slowly taking items off) to see if you get a different result. Alternatively you could also use the following client-side script (this should work, although I have not tested it locally):

   function refreshGrid(sender) {
        var myGrid = $find("<%= RadGrid1.ClientID %>");
        var myGridMasterTableView = myGrid.get_masterTableView();
        var myGridDetailTableView = myGridMasterTableView.get_detailTables()[0]; //select the first detail table
        var myGridMasterTableView.rebind();
        var myGridDetailTableView.rebind();
}

What I'm doing here is just calling rebind on both the MasterTableView and it's first DetailTableView. Might feel a bit ugly, but it will force the detail table to refresh :) For more client-side goodies I recommend reading over this documentation article.

6
  • More detail tables can be opened in the same time, which means that I have to rebind them one by one, using a for cycle, if I understand your answer correctly. Anyway, thank you for your answer, I'll try that out now and will let you know the result. Commented Oct 18, 2011 at 6:19
  • Unfortunately I can't find the get_detailTables function. I've tried your code, get_masterTableView() returns correct data, but get_detailTables() is nonexistent in the object returned by get_masterTableView. Commented Oct 18, 2011 at 9:23
  • Ok, my DetailTables tag is outside of MasterTableView, so finally I managed to reach the get_detailTables function, but even if I rebind it my columns are the same, even if I delete/add columns. Commented Oct 18, 2011 at 9:31
  • 1
    I'm not completely sure what is occurring here, and without the entire sample code it is a bit tricky to figure out. Since this seems to be a very odd and specific case I recommend that you zip up a sample solution which displays the issue and submit it to the Telerik support team - they should be able to help you out here :) Commented Oct 18, 2011 at 14:25
  • Thank you Carl, maybe that's the best thing to do. I have still other tasks and if I'll only have this one, I'll make a sample solution and will send it to them. Thank you again, +1 for constructive behaviour and reasonable ideas. Commented Oct 19, 2011 at 17:20
0

This functionality is not supported in Telerik in this moment, for more information go to this page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.