How do I save 2 radgrids by only 1 outside Button

5 posts, 1 answers
  1. Hiep
    Hiep avatar
    6 posts
    Member since:
    May 2015

    Posted 10 Jun 2015 Link to this post

    Hi, I'm having 2 radgrids (rgRole and rgRecei) in batch edit mode on same page.I'm using 1 html button to call OnBatchEditCommand from outside to save it. But my problem is that it can call only 1 of second radgrid and dismiss the first one. 

    function SaveRg() {
                $find('rgRole').get_batchEditingManager().saveChanges('rgRole_ctl00')
                $find('rgRecei').get_batchEditingManager().saveChanges('rgRecei_ctl00');
                return false;
            }

    So how do i get NewValues of radgrid in code behind in another function like 

    protected void getRadGridNewValues(){

     // get newValue of rgRole here

    // get newValue of rgRecei here

    }

    Any help appreciated,
    Thanks,
    Hiep

  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 12 Jun 2015 Link to this post

    Hello Hiep,

    In order to save the data for multiple RadGrid controls with a single click you can use the saveTableChanges() method. Check out the following code snippets that illustrate the approach.

    Markup:

    <asp:Button Text="Save All" runat="server" ID="Button1" OnClientClick="clientClick(); return false;" />

    JavaScript

    function clientClick() {
                        var grid1 = $find("<%= RadGrid1.ClientID %>");
                        var masterTable1 = grid1.get_masterTableView();
     
                        var grid2 = $find("<%= RadGrid2.ClientID %>");
                        var masterTable2 = grid2.get_masterTableView();
                        var batchEditManager = grid2.get_batchEditingManager();
                        var tables = [];
     
                        tables.push(masterTable1);
                        tables.push(masterTable2);
     
                        batchEditManager.saveTableChanges(tables);
     
                    }


    Regards,
    Viktor Tachev
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hiep
    Hiep avatar
    6 posts
    Member since:
    May 2015

    Posted 15 Jun 2015 in reply to Viktor Tachev Link to this post

    Hi Viktor

    I saw your point but what i need is get value in behind code, because i have to handle and validate it. Can you give me a demo use OnClick event. 

    Thanks,

    Hiep

  5. Hiep
    Hiep avatar
    6 posts
    Member since:
    May 2015

    Posted 17 Jun 2015 Link to this post

    Hi Viktor

    That worked perfectly, thanks so much!

    Hiep

  6. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 18 Jun 2015 Link to this post

    Hello Hiep,

    I am glad to hear that the suggestion was helpful to you. In case you have further queries do not hesitate to contact us again.

    Regards,
    Viktor Tachev
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017