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

Textbox formatting and data types

4 Answers 715 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jasper
Top achievements
Rank 1
Jasper asked on 20 Sep 2010, 03:04 PM
Hi,

I'm trying to create multiple TexBoxes programatically and fill them with values.Works fine so far. Unfortunately I'm can't find any way to format the TextBox using TextBox.Format property.
As far as I know this is caused by the fact that values which are added using TextBox.Value has to be explicit converted to string. Therefore DataTime and currency/number formats can not be applied. If I pass any other data type (using dynamic) to the TextBox.Value it throws an RuntimeBinderException as expected.

Could you tell me how I could create the text boxes programtically, set their values, and format them?


Kind Regards

4 Answers, 1 is accepted

Sort by
0
Jasper
Top achievements
Rank 1
answered on 20 Sep 2010, 03:13 PM
Ok, thinking first is always a good advice.

Value =

 

string.Format("{0:C2}", arg),

 

0
Troy Goddu
Top achievements
Rank 1
answered on 27 Oct 2010, 01:29 PM
This is a good solution, however must we always display strings?  I want to format percentages using something like:

 

 

 

<TextBlock Text="{Binding PCFULL, StringFormat=Test:{0:p}}" Foreground="Gray"/>

 

in a DataTemplate ahead of my RadGridVIew data column definitions.  I'm using DefaultView but this may be interfering with ability to customize the (decimal) strings I'm sending to the DataTable to which I'm binding.   It's not working and I'm discouraged about converting all of my datatables to string fields (and then back!).

Richard
0
Tsvetina
Telerik team
answered on 29 Oct 2010, 03:22 PM
Hello Troy,

Could you please confirm that you are referring RadGrid for ASP.NET AJAX? If not, please post your question in the relevant forum discussing the product line which you use.

All the best,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Troy Goddu
Top achievements
Rank 1
answered on 29 Oct 2010, 07:24 PM

In my case, I was able to use GridViewDataColumn DataFormatString property of the base.   But, Svetina, I searched on topic formatting so am not in the right product line (should have been WPF).   Thank you for redirecting me.

Sincerely,

Richard

 

Tags
Grid
Asked by
Jasper
Top achievements
Rank 1
Answers by
Jasper
Top achievements
Rank 1
Troy Goddu
Top achievements
Rank 1
Tsvetina
Telerik team
Share this question
or