Align content of a row in a table at comma seperator

1 Answer 57 Views
.NET Framework Conditional Formatting
Andriamitantsoa
Top achievements
Rank 1
Andriamitantsoa asked on 25 Oct 2022, 12:42 PM | edited on 25 Oct 2022, 12:51 PM

Hi, 

I have a column in a table (textbox) which contains numbers. They can have 1 or 2 digits and from 0 to 3 decimals. For example,: 100, 10.024, 25.3 . I would like to align all numbers at the decimal seperator for a nice design. 

The only option I found is Style>TextAlign of the textBox, but this does not achieve the desired result.

Thanks in advance.  

Andriamitantsoa
Top achievements
Rank 1
commented on 26 Oct 2022, 10:57 AM

Defining a format for the numbers with a specific number of decimals and aligning the text to the right does the job. 

It still would be cool to know, if there is another possibility to achieve this. In some cases it is not clear in advance what the maximum number of decimals is.

1 Answer, 1 is accepted

Sort by
0
Justin
Telerik team
answered on 27 Oct 2022, 09:01 PM

Hi Andriamitantsoa,

It is good to hear you were able to use the Format property of the textbox to achieve your goal. 

Another way to set the format of the textbox dynamically would be to use the Bindings Property. I would suggest you try to use the built-in Format Function along with other Text Functions to achieve your goal. However, the functionality of the expression builder can be extended with the use of Custom User Functions.

In this simple example, I used the expression editor to change the formatting based on a condition of the value of the Field.

This is the output:

I hope the above example shows a possible pathway for your future reference.

Regards,
Justin
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Tags
.NET Framework Conditional Formatting
Asked by
Andriamitantsoa
Top achievements
Rank 1
Answers by
Justin
Telerik team
Share this question
or