problem in displaying money in grid view.
-
Hi all, In my application i am displaying Amount field in a grid view. which is money type in data base.my problem is when i m displaying it,it shows 4 numbers after decimal like ('45.0000').but i want to display only 2 places after decimal ('45.00').In sql query analyser it shows correctly.I have already used round function but still it is not working. Any suggestions?
-
Hi all, In my application i am displaying Amount field in a grid view. which is money type in data base.my problem is when i m displaying it,it shows 4 numbers after decimal like ('45.0000').but i want to display only 2 places after decimal ('45.00').In sql query analyser it shows correctly.I have already used round function but still it is not working. Any suggestions?
Hi there, is it a bound field? Then you could use the DataFormatString property. In a custom/template field, you could output your value as string and use string.Format with a fitting format string (like here).
-
Hi there, is it a bound field? Then you could use the DataFormatString property. In a custom/template field, you could output your value as string and use string.Format with a fitting format string (like here).
i am using Label to diplay it in a ItemTemplate.
-
Hi all, In my application i am displaying Amount field in a grid view. which is money type in data base.my problem is when i m displaying it,it shows 4 numbers after decimal like ('45.0000').but i want to display only 2 places after decimal ('45.00').In sql query analyser it shows correctly.I have already used round function but still it is not working. Any suggestions?
Please try as below Textbox.Text.ToString("0.00"); Hope this will work for you.
-
i am using Label to diplay it in a ItemTemplate.
Hi, then here is an example on how to do it. Just replace the "((double)0.123)" by your variable and modify the rest according to your needs:
<ItemTemplate>
<asp:Label runat="server" Text='<%# ((double)0.123).ToString("N") %>'></asp:Label>
</ItemTemplate> -
Hi, then here is an example on how to do it. Just replace the "((double)0.123)" by your variable and modify the rest according to your needs:
<ItemTemplate>
<asp:Label runat="server" Text='<%# ((double)0.123).ToString("N") %>'></asp:Label>
</ItemTemplate>it works ,thanx