This is a migrated thread and some comments may be shown as answers.

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

3 Answers 182 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SALVATORE
Top achievements
Rank 1
SALVATORE asked on 29 Nov 2016, 02:34 PM

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

 

3 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 01 Dec 2016, 12:35 PM
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.
0
SALVATORE
Top achievements
Rank 1
answered on 01 Dec 2016, 03:55 PM

Hello Viktor,

I used your hints but it don't work.

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

Thanks

0
Viktor Tachev
Telerik team
answered on 02 Dec 2016, 10:15 AM
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.
Tags
Grid
Asked by
SALVATORE
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
SALVATORE
Top achievements
Rank 1
Share this question
or