Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Radgrid BatchEditCommand - Release Q3 2014 - problem to get data of newly added row

$
0
0

Konstantin,

 I have applied this change and am still unable to have newly created rows passed to the BatchEditCommand event.

I am dynamically generating the Radgrid from code.

 I am using the trial version of Telerik 1st quarter 2015. We are in the process of acquiring the licensed version. I'm thinking the license would not cause this behavior.

Here are snippets of my code:

    <form id="frmList" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function saveChanges() {
                var grid = $find("<%=grdList.ClientID%>");
                var masterTable = grid.get_masterTableView();
                var batchManager = grid.get_batchEditingManager();
                var hasChanges = batchManager.hasChanges(masterTable);
                if (hasChanges) {
                    batchManager.saveChanges(masterTable);
                }
            }
        </script>
    </telerik:RadCodeBlock>
     <telerik:RadButton ID="btnSave" AutoPostBack="false" OnClientClicked="saveChanges" runat="server" Text=" Save "></telerik:RadButton>
        <br /><br />
    <telerik:RadGrid ID="grdList" OnBatchEditCommand="grdList_BatchEditCommand" AllowSorting="True" AllowPaging="True" AllowAutomaticUpdates="true" AllowAutomaticInserts="True"
             AutoGenerateColumns="False" ShowStatusBar="true" runat="server">
     <MasterTableView  EditMode="Batch" CommandItemDisplay="Top" DataKeyNames="SalesCode" Name="SalesCodes"> 
        <BatchEditingSettings OpenEditingEvent="Click" EditType="Row" />
        <CommandItemSettings ShowSaveChangesButton="false" CancelChangesText="Cancel"/>
     </MasterTableView>
    </telerik:RadGrid>
    </div>
    </form>

______________________________________________

                            colText = New GridBoundColumn
                            colText.HeaderText = rsData.Item("FieldCaption")
                            colText.DataField = rsData.Item("FieldName")
                            colText.MaxLength = rsData.Item("FieldLength")
                            iFormWidth = iFormWidth + rsData.Item("FieldWidth") + 3
                            If Not IsDBNull(rsData.Item("FieldDefault")) Then
                                structDefaultValues(iDefaultValues).iCellNumber = rsData.Item("FieldID")
                                structDefaultValues(iDefaultValues).sDefault = rsData.Item("FieldDefault")
                                structDefaultValues(iDefaultValues).sType = rsData.Item("FieldType")
                                iDefaultValues = iDefaultValues + 1
                            End If
                            grdList.MasterTableView.EditFormSettings.CaptionDataField = sKeyField
                            grdList.MasterTableView.Name = strName
                            grdList.MasterTableView.DataKeyNames = arrKeys
                            grdList.Columns.Add(colText)

 

_____________________________________________________

            '--- load fields grid
            cmdList = New OleDb.OleDbCommand(sSQLSelect, gdbMtrk)
            daList = New OleDbDataAdapter(sSQLSelect, gdbMtrk)
            daList.SelectCommand = cmdList
            dsList = New DataSet
            cbList = New OleDbCommandBuilder(daList)
            daList.UpdateCommand = cbList.GetUpdateCommand
            daList.InsertCommand = cbList.GetInsertCommand
            daList.DeleteCommand = cbList.GetDeleteCommand
            dsList.Clear()
            daList.Fill(dsList)

            grdList.DataSource = dsList.Tables(0)

 

 _________________________________________________

     Protected Sub grdList_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs)
        For Each Cmd As GridBatchEditingCommand In e.Commands
            Dim newval As Hashtable = Cmd.NewValues
            Dim oldval As Hashtable = Cmd.OldValues
            'Add to designated table and refresh grid !!!!!
        Next

End Sub


Viewing all articles
Browse latest Browse all 94857

Trending Articles