GRoupSeparator in GridNumericColumn Filter Textbox

2 posts, 1 answers
  1. Albert Shenker
    Albert Shenker avatar
    579 posts
    Member since:
    Mar 2004

    Posted 04 Jan 2017 Link to this post

    I have a client-side bound grid with filtering. I also have a GridNumericColumn set to type Int32. When I type in the grid filter box, the value displayed automatically includes a comma group separator, like "96,546". How do I get rid of the comma separator so it only displays "96546"?
  2. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    2379 posts

    Posted 09 Jan 2017 Link to this post

    Hello Albert,

    By default the GridNumericColumn is using a NumericTextBox for a filter input. It formats the numeric value that is entered based on the Culture applied on the page. This is why you are seeing a separator for the entered number.

    If you would like to change the behavior you can handle the ItemCreated event for the RadGrid and set the GroupSeparator for the numeric input manually. The code snippet below outlines the approach:


    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFilteringItem)
        {
            GridFilteringItem filerItem = (GridFilteringItem)e.Item;
            RadNumericTextBox textItem = (RadNumericTextBox)filerItem["NumericColumn"].Controls[0];
            textItem.NumberFormat.GroupSeparator = "";
        }
    }



    Regards,
    Viktor Tachev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top