Disable Mouse Scroll of GridNumericColumn in EditMode=Batch, EditType=Cell

5 posts, 0 answers
  1. IT Support
     IT Support avatar
    4 posts
    Member since:
    Apr 2012

    Posted 06 Aug 2014 Link to this post

    How can I stop the mouse scroll wheel incrementing and decrementing the values of a GridNumericColumn in my Radrgrid when EditMode="Batch" and EditType="Cell"?

    This post suggests using ItemDataBound: http://www.telerik.com/forums/gridnumericcolumn-edit-control
    However if I step into the debugger the code:
         if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    is never True

    Hope you can help?
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Aug 2014 in reply to IT Support Link to this post

    Hi Mark,

    You can use the GridNumericColumnEditor to control the cell in edit mode. Please try the following code snippet.

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server">
        <MasterTableView  EditMode="Batch">
            <BatchEditingSettings EditType="Cell" />
            <Columns>          
                <telerik:GridNumericColumn UniqueName="Freight" HeaderText="Freight" DataField="Freight" ColumnEditorID="FreightColumnEditor">
                </telerik:GridNumericColumn>        
            </Columns>
        </MasterTableView>   
    </telerik:RadGrid>
    <telerik:GridNumericColumnEditor ID="FreightColumnEditor" runat="server"
     NumericTextBox-IncrementSettings-InterceptMouseWheel="false" >
    </telerik:GridNumericColumnEditor>

    Thanks,
    Princy
  3. Angel Petrov
    Admin
    Angel Petrov avatar
    1076 posts

    Posted 11 Aug 2014 Link to this post

    Hi Mark,

    Another option for you would be obtain a reference to the RadNumericTextBox rendered as an editor for that column and set the InterceptMouseWheel property to false.

    ASPX:
    <Columns>
                       <telerik:GridNumericColumn UniqueName="Freight" DataField="Freight"></telerik:GridNumericColumn>
                   </Columns>

    C#:
    protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            RadNumericTextBox numericEditor = (RadGrid1.MasterTableView.GetBatchColumnEditor("Freight") as GridNumericColumnEditor).NumericTextBox;
            numericEditor.IncrementSettings.InterceptMouseWheel = false;
        }


    Regards,
    Angel Petrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  4. Jeffrey
    Jeffrey avatar
    6 posts
    Member since:
    Jan 2019

    Posted 09 Jan in reply to Angel Petrov Link to this post

    I get the message Telerik.Web.UI.GridException: GridTableView.GetBatchColumnEditor method could be used only when EditMode is set to batch.

    Any advise?

  5. Eyup
    Admin
    Eyup avatar
    3644 posts

    Posted 14 Jan Link to this post

    Hi Jeffrey,

    Batch editing mode is one of the edit modes provided by RadGrid and it can be enabled using the EditMode property of the MasterTableView tag:
    https://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/batch-editing/defaultcs.aspx

    You can check the following resource to see how you can disable arrow key and scroll navigation in the inner controls when using Batch editing:
    https://www.telerik.com/support/kb/aspnet-ajax/grid/details/prevent-numeric-value-changing-with-batch-editing-when-using-keyboard-navigation-with-the-arrow-keys

    I am also sending a sample RadGrid web site.

    Regards,
    Eyup
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top