Set NumberFormat DecimalDigits on RadNumericTextBox into Radgrid with AutoGenerateColumns="true"

4 posts, 0 answers
  1. SALVATORE
    SALVATORE avatar
    6 posts
    Member since:
    May 2016

    Posted 29 Nov 2016 Link to this post

    Hi, I am using a Radgrid with AutoGenerateColumns="true" and set the following parameters:
    BatchEditingSettings-EditType="Cell"
    EditMode="Batch"
    In runtime the values in grid are in 10 decimal digit, but when I go in edit mode in the single cell, the value is shown with 2 decimal digit.
    Please, can you help me to find the way to get 10 decimal digit in edit mode?
    Thanks

    Fulvio

     

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2286 posts

    Posted 01 Dec 2016 Link to this post

    Hello Fulvio,

    In order to change the settings for the numeric column when it is autogenerated you should use the ColumnCreated event of the Grid. In the handler you can set the DecimalDigits property for the column. Check out the code snippet below that outlines the approach:


    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
    {
        if (e.Column.ColumnType == "GridNumericColumn")
        {
            (e.Column as GridNumericColumn).DecimalDigits = 10;
        }
    }


    If you would like additional information on configuring autogenerated columns you would find the following article interesting.



    Regards,
    Viktor Tachev
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
  3. SALVATORE
    SALVATORE avatar
    6 posts
    Member since:
    May 2016

    Posted 01 Dec 2016 in reply to Viktor Tachev Link to this post

    Hello Viktor,

    I used your hints but it don't work.

    Attached you will find the situation I can't resolv.

    Thanks

  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    2286 posts

    Posted 02 Dec 2016 Link to this post

    Hello,

    Please find the attached project that works as expected on my end. Give it a try and let me know how it works for you.

    Try to use similar approach and you would be able to implement the behavior you are looking for.


    Regards,
    Viktor Tachev
    Telerik by Progress
    Telerik UI for ASP.NET AJAX is ready for Visual Studio 2017 RC! Learn more.
Back to Top