Author |
Topic |
krishnet
Starting Member
29 Posts |
Posted - 2007-05-13 : 13:48:52
|
Hello frdz, I m using ASP.NET with C# 2.0 I want to use the dataformat string in the gridview to display the salary.I have tried with the currency but it shows the amt in $ and i want it in Indian Rupees and to be displayed as Rs1,00,000.00 <asp:BoundField DataField="salary" HeaderText="Salary" DataFormatString=" " htmlencode="False" /> Can anyone help to say what can be written ??Any replies are appreciated...thanxsRs1,00,000.00 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-13 : 13:53:19
|
Rs#,##,###.##_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
|
|
krishnet
Starting Member
29 Posts |
Posted - 2007-05-16 : 06:02:29
|
Thanxs very much for ur suggestion..But,it gives me the following errorInput string was not in a correct format. Exception Details:System.FormatException: Input string was not in a correct format.I have tried writting in diff ways as follows :DataFormatString="{C:Rs#,##,###.##}"DataFormatString=" Rs#,##,###.## "DataFormatString="{Rs#,##,###.## }"I need to format the string in the boundfield.<asp:BoundField DataField="salary" HeaderText="Salary" DataFormatString=" Rs#,##,###.## " htmlencode="False" />Without formating the field of salary it runs fine but i want to format it with the rupees.Can u rectify where i m going wrong pls..Ur help is needed again |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-16 : 06:47:38
|
What do you get if you use this?<asp:BoundField DataField="salary" HeaderText="Salary" DataFormatString="#,##,###.## " htmlencode="False" />MadhivananFailing to plan is Planning to fail |
|
|
krishnet
Starting Member
29 Posts |
Posted - 2007-05-16 : 07:14:00
|
DataFormatString="{#,##,###.##}"...This gives the errorDataFormatString="#,##,###.##" ...This does not takes data from database but shows the same string in the gridviewthanxs |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-16 : 10:53:26
|
Also note that it is not possible to format the currency in the way it is formatted in IndiaMadhivananFailing to plan is Planning to fail |
|
|
krishnet
Starting Member
29 Posts |
Posted - 2007-05-16 : 13:04:38
|
Thanxs...jsmith8858madhivanan try as jsmith8858 said it's working... jsmith8858The problem is that it does not allow the value after the decimal as "0"if the value is 123.00 it accepts only 123 or if it is Rs123.50 then only Rs123.5That's fine but if u know how to take it as Rs123.50 then do let me know..Thanxxs for ur help. |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
|
krishnet
Starting Member
29 Posts |
Posted - 2007-05-16 : 14:52:16
|
Thanxs very much...it worked out my frd successfully..Got as i wanted the output..This could be helpful to many members i think.. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-17 : 01:31:05
|
Well. As I told you earlier, the format you would get is, If the value is 100000,100,000.00If you want it to get in Indian way of formation, then you may try usingDataFormatString="Rs{0:#,##,###.00}"so that you can get this format1,00,000.00But I doubt if the above formation is possibleMadhivananFailing to plan is Planning to fail |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-05-17 : 08:15:03
|
Madhivanan -- no one told him earlier to use that exact format string; none of them included the "{0:" part. And you can get that format, try it! It's a custom format string -- you can have a format like "##,#,####,#,##" if you want ...- Jeffhttp://weblogs.sqlteam.com/JeffS |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-17 : 08:39:41
|
quote: Originally posted by jsmith8858 Madhivanan -- no one told him earlier to use that exact format string; none of them included the "{0:" part. And you can get that format, try it! It's a custom format string -- you can have a format like "##,#,####,#,##" if you want ...- Jeffhttp://weblogs.sqlteam.com/JeffS
Thats cool. I am unable to test that as I dont use .NET MadhivananFailing to plan is Planning to fail |
|
|
|