Checkbox uses changeEditor, but need to call other code

2 posts, 0 answers
  1. Jeremy Yoder
    Jeremy Yoder avatar
    131 posts
    Member since:
    Dec 2009

    Posted 05 Apr 2016 Link to this post


    Checkboxes in a batch grid require an extra click to put them into Edit mode, but that's fixed with this code I got on this forum...

    function changeEditor(sender) {
        var grd = GetControlRAD("grdPODetails");
        var batchManager = grd.get_batchEditingManager();
        sender.checked = !sender.checked;

    <telerik:RadGrid ID="grdPODetails" runat="server" AllowSorting="True" AutoGenerateColumns="False" Skin="Office2010Blue" GridLines="None">
        <HeaderContextMenu EnableAutoScroll="True">
        <MasterTableView CommandItemDisplay="Top" EditMode="Batch" InsertItemDisplay="Bottom"
            <BatchEditingSettings EditType="Cell" OpenEditingEvent="Click" />
            <CommandItemSettings ShowRefreshButton="False" ShowSaveChangesButton="true" ShowCancelChangesButton="true" />
                No detail lines to display.
                <telerik:GridTemplateColumn DataField="PrintOnPurchaseOrder" HeaderText="Print" UniqueName="PrintOnPurchaseOrder" DataType="System.Boolean">
                    <HeaderStyle Width="40px" />
                    <ItemStyle Width="40px" />
                        <input id="chkPrint" type="checkbox" checked='<%# Eval("PrintOnPurchaseOrder") %>' onclick="changeEditor(this);" />
                        <asp:CheckBox ID="chkPrint" runat="server" Checked='<%# Bind("PrintOnPurchaseOrder") %>' />
                <telerik:GridTemplateColumn DataField="PostToGeneralLedger" HeaderText="Post" UniqueName="PostToGeneralLedger" DataType="System.Boolean">
                    <HeaderStyle Width="40px" />
                    <ItemStyle Width="40px" />
                        <input id="chkPost" type="checkbox" checked='<%# Eval("PostToGeneralLedger") %>' onclick="changeEditor(this);" />
                        <asp:CheckBox ID="chkPost" runat="server" Checked='<%# Bind("PostToGeneralLedger") %>' />
                <telerik:GridTemplateColumn DataField="UnitDescription" UniqueName="UnitDescription" HeaderText="Unit Desc" DataType="System.String">
                        <asp:Label ID="lblUnitDescription" runat="server"
                            Text='<%# Eval("UnitDescription") %>'>
                        <telerik:RadTextBox ID="txtUnitDescription" runat="server" MaxLength="10" Width="100%"
                        Text='<%# Bind("UnitDescription") %>' >
        <ClientSettings AllowKeyboardNavigation="true">
            <Selecting AllowRowSelect="True" />


    A breakpoint in changeEditor shows it's only called once, to put it in edit mode. But the first time you click it (and every time following if you keep clicking it while still in edit mode) I need to handle that event. For instance, in this grid, if I check the checkbox in the 2nd column, how can I set column "UnitDescription" in the same row to "A", but if I uncheck the checkbox (while still in EditMode) it sets UnitDescription" to "B"?

    I tried putting an event handler on the checkbox within EditItemTemplate, but that didn't work... or I did it wrong. It's almost like when it opens in edit mode, a new checkbox is created on the fly. But I can't figure out where it is or how to grab its events. Please help.


  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 08 Apr 2016 Link to this post

    Hi Jeremy,

    A possible solution is to update the cell value by calling changeCellValue method and pass the cell element and the new value. Please check out the following help article for more information. Additionally you can examine the following how to article for more details.

    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