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

RadGrid Columns

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ruchin
Top achievements
Rank 1
Ruchin asked on 03 Aug 2010, 05:21 PM
I have 4 columns in my radgrid and in one of the column there are some negative values as well as positive, will it be possible to put all the negative values in brackets.
Example:

 Product Name

Product ID

Values

A

1

$ -12.00 

B

2

$11

C

3

$ - 13

D

4

$ 14

E

5

$ - 16

F

6

$ - 17

 

 

 


so i want all the negative values of coulmn "values" into brackets and without $ sign.
Expected result

 Product Name

Product ID

Values

A

1

$(12.00 )

B

2

$11

C

3

$(13)

D

4

$ 14

E

5

$(16)

F

6

$(17)

 

 

 


Please help.

Thanks

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Aug 2010, 01:18 PM
Hello Ruchin,


In order to achieve this set the DataFormatString property of GridBoundColumn like below.

ASPX:
<telerik:GridBoundColumn UniqueName="Values" DataFormatString="{0:$#,##;(#,##);Zero}"
                       DataField="Values" HeaderText="Values" DataType="System.Int32" />

Thanks,
Princy.
0
Ruchin
Top achievements
Rank 1
answered on 05 Aug 2010, 04:19 PM
Hi Princy,
i have already tried your solution earlier and its not working and giving an invalid expression error.
well i tried with one more solution as :

I made one function and pass my string to tht and in that function the below line :

Microsoft.VisualBasic.Strings.FormatCurrency(str, 2, TriState.UseDefault, TriState.True, TriState.True);

Thanks,
Ruchin goel
Tags
Grid
Asked by
Ruchin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Ruchin
Top achievements
Rank 1
Share this question
or