Batch edit doesn't work when Save button click

3 posts, 0 answers
  1. Cheng-Chang
    Cheng-Chang avatar
    10 posts
    Member since:
    Nov 2014

    Posted 26 Apr 2018 Link to this post

    I am not sure what's wrong with save event in editmode=batch

    • when I click save, it doesn't fire RadGrid1_BatchEditCommand

        MasterTableView-CommandItemSettings-ShowSaveChangesButton="true" 

     

    • even if I change the button to commandtemplate

    <telerik:RadPushButton runat="server" ID="SaveChangesButton" Text="儲存" OnClientClicked="saveChangesToGrid" AutoPostBack="false" CommandName="UpdateAll">
    <Icon CssClass="rgSaveIcon" />
    </telerik:RadPushButton>

     

    I click save and then browser doesn't response error and C# event doesn't fired event handler method. I am sure it has executed 

     

    following is my setting of grid:

    <telerik:RadGrid RenderMode="Lightweight" ID="RadGrid1" GridLines="Both" runat="server"
        OnItemCommand="RadGrid1_ItemCommand"
        OnItemDataBound="RadGrid1_ItemDataBound"
        OnNeedDataSource="RadGrid1_NeedDataSource"
        OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
        OnBatchEditCommand="RadGrid1_BatchEditCommand"
        OnPreRender="RadGrid1_PreRender"
        AutoGenerateColumns="False"
        AllowPaging="false"
        MasterTableView-HierarchyLoadMode="ServerBind"
        ClientSettings-AllowExpandCollapse="false"
        ClientSettings-EnablePostBackOnRowClick="false"
        MasterTableView-CommandItemSettings-ShowSaveChangesButton="true"
        MasterTableView-CommandItemSettings-ShowAddNewRecordButton="false"
        MasterTableView-CommandItemSettings-ShowCancelChangesButton="false"
        MasterTableView-CommandItemSettings-ShowRefreshButton="false"
        MasterTableView-CommandItemSettings-SaveChangesText="儲存"
        MasterTableView-HierarchyDefaultExpanded="false">
        <MasterTableView Name="Master"
            CommandItemDisplay="TopAndBottom"
            DataKeyNames="itemno"
            ClientDataKeyNames="itemno"
            EditMode="Batch"
            HorizontalAlign="NotSet"
            AutoGenerateColumns="False">
            <BatchEditingSettings EditType="Cell" SaveAllHierarchyLevels="true" />
             
            <DetailTables>
                <telerik:GridTableView DataKeyNames="itemno,seqno"
                    AllowPaging="false"
                    AllowAutomaticInserts="true"
                    CommandItemDisplay="Top"
                     CommandItemSettings-AddNewRecordText="新增"
                    CommandItemSettings-ShowAddNewRecordButton="true"
                    CommandItemSettings-ShowCancelChangesButton="false"
                    CommandItemSettings-ShowRefreshButton="false"
                    CommandItemSettings-ShowSaveChangesButton="false" 
                    EditMode="InPlace"
                    Name="Details"
                    Width="100%" runat="server" >
                    <Columns>
                    ......
                    </Columns>
                </telerik:GridTableView>
            </DetailTables>
     
            <Columns>
            ......
            </Columns>
            </MasterTableView>
        <ClientSettings AllowKeyboardNavigation="true"></ClientSettings>
    </telerik:RadGrid>

     

  2. Cheng-Chang
    Cheng-Chang avatar
    10 posts
    Member since:
    Nov 2014

    Posted 26 Apr 2018 Link to this post

    From my perspective, batch edit in first way will trigger RadGrid1_BatchEditCommand, and the second will trigger RadGrid1_ItemCommand by javascript.

    Am I right?

  3. Attila Antal
    Admin
    Attila Antal avatar
    425 posts

    Posted 26 Apr 2018 Link to this post

    HI Cheng-Chang,

    That is correct. The built-in button for saving the changes will trigger the BatchEditCommand while the button from the CommandItemTemplate with CommandName "UpdateAll" will trigger the ItemCommand event.

    I've tested the sample markup from below and both commands fire in both scenarios. If it does not fire at your end, I advise checking for JavaScript errors, or anything that could prevent the postback from happening.

    I would like to note that in case of using CommandItemTemplate with a button to save the changes, the button should be set to do a Postback. The current example prevents the postback, hence the ItemCommand event does not fire.

    If the issue still persist, please try to isolate the issue in a sample project and send it back to us for further investigation.

    Kind regards,
    Attila Antal
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top