Bug!! RadGrid BatchEdit : Unable to get property 'cell' of undefined or null reference

8 posts, 0 answers
  1. Supaporn
    Supaporn avatar
    7 posts
    Member since:
    Oct 2014

    Posted 10 Jan Link to this post

    When Use  two Grid in 1 Page There are GridTemplateColumn EditItemTemplate in both grid

    EditMode="Batch"  & save by function saveTableChanges

    - TemplateColumn not work 

    - GridBoundColumn it Work
    - ColumnEditor it Work
    - 1 Grid on 1 Page GridBoundColumn it Work

     

    <head>
        <title>Test</title>
        <script type="text/javascript">
            function SaveAllChanges(sender, args) {
                var b = $find('<%=RadGrid1.ClientID%>').get_batchEditingManager();
                var tableViews = [];
         
                tableViews.push($find('<%=RadGrid1.ClientID%>').get_masterTableView());
                tableViews.push($find('<%=RadGrid3.ClientID%>').get_masterTableView());
                b.saveTableChanges(tableViews);
            }
     
     
     
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <telerik:RadScriptManager Runat="server"></telerik:RadScriptManager>
             
             
            <telerik:RadButton runat="server" ID="RadButton1" Text="SaveAllChanges" AutoPostBack="false" OnClientClicked="SaveAllChanges"></telerik:RadButton>
     
             
     
     
            <telerik:GridNumericColumnEditor ID="NumericEditor1" runat="server">
                <NumericTextBox ID="NumericTextBox1" runat="server" Width="60px" />
            </telerik:GridNumericColumnEditor>
             
            <telerik:GridTextBoxColumnEditor runat="server" ID="TextEditor">
                <TextBoxStyle Width="120px" />
            </telerik:GridTextBoxColumnEditor>
     
     
            <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource3"
                AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
                AllowAutomaticDeletes="true" AllowSorting="true" PageSize="3" OnBatchEditCommand="RadGrid1_BatchEditCommand">
                <PagerStyle Mode="NextPrevAndNumeric" />
                <MasterTableView DataSourceID="SqlDataSource3" AutoGenerateColumns="False"
                    DataKeyNames="CustomerID" EditMode="Batch" CommandItemDisplay="Top">
                    <Columns>
          
                         
     
                        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
                            UniqueName="CustomerID">
                        </telerik:GridBoundColumn>
     
     
                       <telerik:GridTemplateColumn HeaderText="ContactName" HeaderStyle-Width="180px" UniqueName="ContactName" >
                            <ItemTemplate>
                                <%# Eval("ContactName") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" Text='<%# Bind("ContactName") %>' runat="server"></asp:TextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
     
     
                        <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName"
                            UniqueName="CompanyName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle"
                            UniqueName="ContactTitle">
                        </telerik:GridBoundColumn>
                  
     
                         
                     <telerik:GridBoundColumn DataField="Phone" HeaderStyle-Width="135px" HeaderText="Quantity Per Unit"
                            SortExpression="" ColumnEditorID="TextEditor" UniqueName="QuantityPerUnit">
                        </telerik:GridBoundColumn>
     
     
                        <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
     
     
     
     
            <!--Grid2------------>
     
            <telerik:RadGrid ID="RadGrid3" GridLines="None" runat="server" AllowAutomaticDeletes="True"
                AllowAutomaticInserts="True" PageSize="3" Skin="Default" AllowAutomaticUpdates="True" AllowPaging="True"
                AutoGenerateColumns="False" Width="750px" OnBatchEditCommand="RadGrid3_BatchEditCommand" DataSourceID="SqlDataSource1">
     
     
                <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ProductID"
                    DataSourceID="SqlDataSource1" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
                    <BatchEditingSettings EditType="Cell" />
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="ProductID" SortOrder="Descending" />
                    </SortExpressions>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ProductName" HeaderStyle-Width="210px" HeaderText="ProductName" SortExpression="ProductName"
                            UniqueName="ProductName">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" Text="*This field is required">
                                </RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Category" HeaderStyle-Width="180px" UniqueName="CategoryID" DataField="CategoryID">
                            <ItemTemplate>
                                <%# Eval("CategoryName") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadDropDownList runat="server" ID="CategoryIDDropDown" DataValueField="CategoryID"
                                    DataTextField="CategoryName" DataSourceID="SqlDataSource2">
                                </telerik:RadDropDownList>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridNumericColumn DataField="UnitsInStock" HeaderStyle-Width="80px"
                            ColumnEditorID="NumericEditor1" HeaderText="Units In Stock" SortExpression="UnitsInStock"
                            UniqueName="UnitsInStock">
                        </telerik:GridNumericColumn>
                        <telerik:GridBoundColumn DataField="QuantityPerUnit" HeaderStyle-Width="135px" HeaderText="Quantity Per Unit"
                            SortExpression="QuantityPerUnit" ColumnEditorID="TextEditor" UniqueName="QuantityPerUnit">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn DataField="Discontinued" HeaderStyle-Width="80px" HeaderText="Discontinued" SortExpression="Discontinued"
                            UniqueName="Discontinued">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridTemplateColumn HeaderText="UnitPrice" ColumnEditorID="NumericEditor1"
                            HeaderStyle-Width="80px" SortExpression="UnitPrice" UniqueName="TemplateColumn"
                            DataField="UnitPrice">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Eval("UnitPrice", "{0:C}") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <span>
                                    <telerik:RadNumericTextBox Width="55px" runat="server" ID="tbUnitPrice">
                                    </telerik:RadNumericTextBox>
                                    <span style="color: Red">
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                                            ControlToValidate="tbUnitPrice" ErrorMessage="*Required" runat="server">
                                        </asp:RequiredFieldValidator>
                                    </span>
                                </span>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" ButtonType="ImageButton"
                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
  2. Supaporn
    Supaporn avatar
    7 posts
    Member since:
    Oct 2014

    Posted 12 Jan Link to this post

    Could someone please see if this is the issue with telerik ?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 13 Jan Link to this post

    Hello Supaporn,

    The behavior you describe was an issue in a previous version of the controls. In the current release the data in both grids should be saved. Please ensure that you are using the most recent version of the controls and see how the behavior changes. The current version of the controls is 2015.3.1111.

    I tested the behavior and it is working as expected on my end. I am attaching the sample page used for testing. Give it a try and see how it works for you.


    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
  5. Supaporn
    Supaporn avatar
    7 posts
    Member since:
    Oct 2014

    Posted 13 Jan Link to this post

    I use Telerik version 2015.3.1111. 
  6. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 14 Jan Link to this post

    Hello,

    Would you run the sample project from my previous post and let me know how it works on your end?

    Also, would you let me know what needs to be changes in the sample in order to replicate the behavior you are seeing?

    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
  7. Supaporn
    Supaporn avatar
    7 posts
    Member since:
    Oct 2014

    Posted 21 Jun Link to this post

    Example Not Work.
    I want to RadGrid1_BatchEditCommand  and RadGrid3_BatchEditCommand.

    I Show Code and Send Photo error and version Telerik to Me.

     

    <head>
        <title>Test</title>
        <script type="text/javascript">
            function SaveAllChanges(sender, args) {
               try {
                  var b = $find('<%=RadGrid1.ClientID%>').get_batchEditingManager();
                  var tableViews = [];
          
                  tableViews.push($find('<%=RadGrid1.ClientID%>').get_masterTableView());
                  tableViews.push($find('<%=RadGrid3.ClientID%>').get_masterTableView());
                  b.saveTableChanges(tableViews);
               }
                    catch (e) {
                        alert(e);
                    }
            }
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <telerik:RadScriptManager Runat="server"></telerik:RadScriptManager>
              
              
            <telerik:RadButton runat="server" ID="RadButton1" Text="SaveAllChanges" AutoPostBack="false" OnClientClicked="SaveAllChanges"></telerik:RadButton>
      
              
      
      
            <telerik:GridNumericColumnEditor ID="NumericEditor1" runat="server">
                <NumericTextBox ID="NumericTextBox1" runat="server" Width="60px" />
            </telerik:GridNumericColumnEditor>
              
            <telerik:GridTextBoxColumnEditor runat="server" ID="TextEditor">
                <TextBoxStyle Width="120px" />
            </telerik:GridTextBoxColumnEditor>
      
      
            <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource3"
                AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True"
                AllowAutomaticDeletes="true" AllowSorting="true" PageSize="3" >
                <PagerStyle Mode="NextPrevAndNumeric" />
                <MasterTableView DataSourceID="SqlDataSource3" AutoGenerateColumns="False"
                    DataKeyNames="CustomerID" EditMode="Batch" CommandItemDisplay="Top">
                    <Columns>
           
                          
      
                        <telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
                            UniqueName="CustomerID">
                        </telerik:GridBoundColumn>
      
      
                       <telerik:GridTemplateColumn HeaderText="ContactName" HeaderStyle-Width="180px" UniqueName="ContactName" >
                            <ItemTemplate>
                                <%# Eval("ContactName") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" Text='<%# Bind("ContactName") %>' runat="server"></asp:TextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
      
      
                        <telerik:GridBoundColumn DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName"
                            UniqueName="CompanyName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="ContactTitle" HeaderText="ContactTitle" SortExpression="ContactTitle"
                            UniqueName="ContactTitle">
                        </telerik:GridBoundColumn>
                   
      
                          
                     <telerik:GridBoundColumn DataField="Phone" HeaderStyle-Width="135px" HeaderText="Quantity Per Unit"
                            SortExpression="" ColumnEditorID="TextEditor" UniqueName="QuantityPerUnit">
                        </telerik:GridBoundColumn>
      
      
                        <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
      
      
      
      
            <!--Grid2------------>
      
            <telerik:RadGrid ID="RadGrid3" GridLines="None" runat="server" AllowAutomaticDeletes="True"
                AllowAutomaticInserts="True" PageSize="3" Skin="Default" AllowAutomaticUpdates="True" AllowPaging="True"
                AutoGenerateColumns="False" Width="750px" DataSourceID="SqlDataSource1">
      
      
                <MasterTableView CommandItemDisplay="TopAndBottom" DataKeyNames="ProductID"
                    DataSourceID="SqlDataSource1" HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
                    <BatchEditingSettings EditType="Cell" />
                    <SortExpressions>
                        <telerik:GridSortExpression FieldName="ProductID" SortOrder="Descending" />
                    </SortExpressions>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ProductName" HeaderStyle-Width="210px" HeaderText="ProductName" SortExpression="ProductName"
                            UniqueName="ProductName">
                            <ColumnValidationSettings EnableRequiredFieldValidation="true">
                                <RequiredFieldValidator ForeColor="Red" Text="*This field is required">
                                </RequiredFieldValidator>
                            </ColumnValidationSettings>
                        </telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn HeaderText="Category" HeaderStyle-Width="180px" UniqueName="CategoryID" DataField="CategoryID">
                            <ItemTemplate>
                                <%# Eval("CategoryName") %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <telerik:RadDropDownList runat="server" ID="CategoryIDDropDown" DataValueField="CategoryID"
                                    DataTextField="CategoryName" DataSourceID="SqlDataSource2">
                                </telerik:RadDropDownList>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridNumericColumn DataField="UnitsInStock" HeaderStyle-Width="80px"
                            ColumnEditorID="NumericEditor1" HeaderText="Units In Stock" SortExpression="UnitsInStock"
                            UniqueName="UnitsInStock">
                        </telerik:GridNumericColumn>
                        <telerik:GridBoundColumn DataField="QuantityPerUnit" HeaderStyle-Width="135px" HeaderText="Quantity Per Unit"
                            SortExpression="QuantityPerUnit" ColumnEditorID="TextEditor" UniqueName="QuantityPerUnit">
                        </telerik:GridBoundColumn>
                        <telerik:GridCheckBoxColumn DataField="Discontinued" HeaderStyle-Width="80px" HeaderText="Discontinued" SortExpression="Discontinued"
                            UniqueName="Discontinued">
                        </telerik:GridCheckBoxColumn>
                        <telerik:GridTemplateColumn HeaderText="UnitPrice" ColumnEditorID="NumericEditor1"
                            HeaderStyle-Width="80px" SortExpression="UnitPrice" UniqueName="TemplateColumn"
                            DataField="UnitPrice">
                            <ItemTemplate>
                                <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Eval("UnitPrice", "{0:C}") %>'></asp:Label>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <span>
                                    <telerik:RadNumericTextBox Width="55px" runat="server" ID="tbUnitPrice">
                                    </telerik:RadNumericTextBox>
                                    <span style="color: Red">
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1"
                                            ControlToValidate="tbUnitPrice" ErrorMessage="*Required" runat="server">
                                        </asp:RequiredFieldValidator>
                                    </span>
                                </span>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridButtonColumn ConfirmText="Delete this product?" ConfirmDialogType="RadWindow"
                            ConfirmTitle="Delete" HeaderText="Delete" HeaderStyle-Width="50px" ButtonType="ImageButton"
                            CommandName="Delete" Text="Delete" UniqueName="DeleteColumn">
                        </telerik:GridButtonColumn>
                    </Columns>
                </MasterTableView>
            </telerik:RadGrid>
     
    <!-----------Behind Code ----------->
    Protected Sub Grid1_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles Grid1.BatchEditCommand
       If e.Commands.Count > 0 Then
        '.............................................
       End If
    End Sub
     
    Protected Sub Grid3_BatchEditCommand(sender As Object, e As GridBatchEditingEventArgs) Handles Grid3.BatchEditCommand
       If e.Commands.Count > 0 Then
        '.............................................
       End If
    End Sub
  8. Supaporn
    Supaporn avatar
    7 posts
    Member since:
    Oct 2014

    Posted 22 Jun Link to this post

    Could someone please see if this is the issue with telerik or I Code wrong ?

    Please answer The right way.

    Thank you.

     

  9. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 24 Jun Link to this post

    Hello,


    Please upgrade the controls to the latest release and see how it works for you. The current release is 2016.2.607. You can download it from our website after logging in to your account.


    Regards,
    Viktor Tachev
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017