"Editor cannot be initialized for column" problem with batch mode

5 posts, 1 answers
  1. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 06 Jan 2014 Link to this post

    Greetings,

    I have a setup in which I want to set the values of cells of a certain column programmatically. The column won't be displayed to the user, so I set Display=false

    The grid is a batch mode grid, and I set the values before the user saves the data as follows:

    grid.add_command(function (sender, args)
            {
                if(args.get_commandName() == "BatchEdit")
                {
                    var tv = grid.get_masterTableView(),
                        bm = grid.get_batchEditingManager(),
                        dumpCellIndex = tableView.getColumnByUniqueName("Dump").get_element().cellIndex;
     
                    tv.get_dataItems().forEach(function (di)
                    {
                        var row = di.get_element();
     
                        if(row._data)
                            bm.changeCellValue(row.cells[dumpCellIndex], row._data.join(";"));
                    });
                }
            });

    On the server, I get the following error in the BatchEditCommand event handler when I try to access the Commands member of GridBatchEditingEventArgs: "Editor cannot be initialized for column: Dump"

    I tried to set Display=true but still the problem happens. Dump is just a simple GridBoundColumn:

    <telerik:GridBoundColumn Display="true" DataType="System.String" FilterControlAltText="Filter Dump column" UniqueName="Dump" ReadOnly="false" ForceExtractValue="None">
                                <ColumnValidationSettings>
                                    <ModelErrorMessage Text="" />
                                </ColumnValidationSettings>
                            </telerik:GridBoundColumn>

  2. Answer
    Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 09 Jan 2014 Link to this post

    Hi Ashraf,

    I tried reproducing the described issue in an isolated sample but to no avail. Could you please examine the attached website and tell us what differs in your case?

    Additionally I would suggest changing the cells value prior to clicking the SaveChanges button as the OnCommand event is fired too late for that purpose. Also I did not notice a DataField to be set for the column. That said could you please elaborate more on how are the cells populated?

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 09 Jan 2014 Link to this post

    It appears that GridBoundColumn must have the DataField property set, otherwise it will cause this problem.
    I changed the column to a TemplateColumn and now the problem doesn't happen.

    I have to write these data before the save operation. What event is suitable for this?
  5. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 14 Jan 2014 Link to this post

    Hi Ashraf,

    Could you please elaborate more on the exact requirement? Can you tell us which rows should have a changed value before they are submitted?

    Changing the values by subscribing to an event which is fired once the Save Changes button is clicked will not work because the grid will already have extracted the data from the HTML. Is there a reason which prevents you from using the OnBatchEditCommand server-side event for manipulating the data?

    Regards,
    Angel Petrov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  6. Ashraf Sabry
    Ashraf Sabry avatar
    88 posts
    Member since:
    Jan 2011

    Posted 14 Jan 2014 Link to this post

    I've cancelled the idea of using a hidden column. I'll use a hidden input to store the values instead.

    Thanks for your reply.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017