RadGrid within DataForm

3 posts, 0 answers
  1. Mark
    Mark avatar
    12 posts
    Member since:
    Jul 2015

    Posted 18 May Link to this post

    Hi,

    I have a Radgrid within a dataform. When the user click edit on the Dataform I can get the Radgrid to display in Batch edit mode.

    But on pressing the Update button on the Dataform, how do I get the values of the edited grid in code behind.

    I already use the _ItemUpdating event for the Dataform, and thought I would be able to see the values of the edited grid with EditItems

    But it seems not.

    Many Thanks for any help

    Mark

  2. Mark
    Mark avatar
    12 posts
    Member since:
    Jul 2015

    Posted 19 May in reply to Mark Link to this post

    In a very roundabout way I have managed to get it to work.

    The RadGrid is sitting in the EditItemTemplate of a RadDataForm. And when the page displays the RadGrid is in Batch Edit mode  <MasterTableView EditMode="Batch" ></MasterTableView>

    Ideally I would like to extract all the values of the RadGrid when the user clicks the RadDataForm Update button within the RadDataForm_ItemUpdating event.
    But this doesn’t seem possible.
    So I have used OnClientClicked=" SaveSeasonCosts " on the RadDataForm Update button, this calls a javascript function to mimic the update of the grid.

    Function SaveSeasonCosts(Sender, args) {

      var id = Sender.get_element().id;
    var GetGridClientID = $get(id).getAttribute("GID");

    var grid = $find(GetGridClientID);
     grid.get_batchEditingManager().saveChanges(grid.get_masterTableView());

    }


    Which in turn fires the _BatchEditCommand event of the RadGrid where I can get to the values.

    So is this the way to do this? Other than javascript is there no other way to invoke an update of the grid when the RadDataForm updates?

    Many Thanks

    Mark
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 23 May Link to this post

    Hello Mark,

    Yes, you are correct. Essentially, Batch editing mode is different than other modes. You can find a detailed explanation in the following section:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-controls-in-batch-edit-mode


    You need to use the Batch client-side API to execute your logic:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/data-editing/edit-mode/batch-editing/client-side-api

    For using an external button to save the records, you can check the following post:
    http://www.telerik.com/forums/how-to-fire-the-updateedited-method-from-an-outside-button#5Af7aU0fFEa0UKS5HOhyjA

    The crucial key requirement here is that the postback should be initiated by the Batch client-side API commands. I hope the clarification was helpful.


    Regards,
    Eyup
    Telerik
Back to Top