Need help with RadGrid

4 posts, 0 answers
  1. Tim Inouye
    Tim Inouye avatar
    4 posts
    Member since:
    Jul 2009

    Posted 21 May 2015 Link to this post


     I'm new to the RadGird control and am trying to use the Batch editing capability.

     I am populating the control from code and have set the OnBatchEditCommand on the form.

    When I view the form and add items using the Add New Item prompt I am able to create new items.  However, when I Click Save Changes my BatchEditCommand event  is fired, but the command collection count is zero.

    I have included a screen shot and snippets of code:

        <form id="frmList" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadGrid ID="grdList" OnBatchEditCommand="grdList_BatchEditCommand" AllowSorting="True" AllowPaging="True" AutoGenerateColumns="False" runat="server">
         <MasterTableView  EditMode="Batch" CommandItemDisplay="Top" DataKeyNames="Code" Name="SalesCodes"> 
            <BatchEditingSettings OpenEditingEvent="Click" EditType="Cell" />


                                 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


        Protected Sub grdList_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs)
            For Each Cmd As GridBatchEditingCommand In e.Commands
                Dim newval As Hashtable = Cmd.NewValues
        End Sub


  2. Tim Inouye
    Tim Inouye avatar
    4 posts
    Member since:
    Jul 2009

    Posted 22 May 2015 Link to this post

    After further testing I've found edited rows are passed to the OnBatchEditCommand event, but no added rows are passed.

    Can someone help me with this.

  3. Viktor Tachev
    Viktor Tachev avatar
    1784 posts

    Posted 26 May 2015 Link to this post

    Hello Tim,

    I examined the code and noticed that the columns in RadGrid are added in the code-behind. Given that RadGrid is declared in the markup I guess that the columns are added in Page_Load.

    Note that in this scenario the columns should be added to the GridTableView before their properties are defined. Check out the following article where the approach is illustrated.

    Try to modify the code and see if the behavior changes. In case the issue persists, please share the complete markup with the related code-behind. Thus, we will be able to examine the code and look for what could cause the behavior.

    Viktor Tachev
    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
  4. Tim Inouye
    Tim Inouye avatar
    4 posts
    Member since:
    Jul 2009

    Posted 26 May 2015 in reply to Viktor Tachev Link to this post

    Thank you VIktor !!

    That solved the problem.

    Best regards,

    Tim Inouye

Back to Top