Dear All,
I am using Imagistics webgrid for binding data’s from my databases. I had bounded a decimal value to the below column and even I has also specified a DataFormatString as ="{0:0.00}".when I run the page and try to enter some decimal values it shows an error as “Microsoft JScript runtime error: Sys.FormatException: Format specifier was invalid”. I tried several ways, but no result. Could you please help me over this?
For your reference I am pasting below by script of the column in my grid and the scrren shot of the error message which I gets whne I try to enter a decimal values to the cells in the below column.
<ig:BoundDataField DataFieldName="Km" DataType="System.Decimal" Key="Km"
Width="50px" DataFormatString="{0:0.00}" CssClass="style1" >
<Header Text="Km" />
</ig:BoundDataField>
Regards
Rajesh Kamalakshan
Hello Rajesh,As far as I can see you are using format which is used to format outputs. Please take a look at the following links http://sharpertutorials.com/string-formatting/ and http://blog.stevex.net/string-formatting-in-csharp/ There are no supported format as used from you. Please try the {0:0.0} format which is pointed. Also you can see which formats are supported form ASP in the following post - http://seejoelprogram.wordpress.com/2008/08/07/supported-number-and-datetime-format-strings-in-aspnet-ajax/ If you need further assistance please point what is your exact build of NetAdvantage.
Dear Nikifor,
I tried formatting as below, but even it is showing the same error. The column is pretty formatted as per the format at the time of initial binding, but when I try to edit the cell in browser it is showing the same error.
Width="50px" DataFormatString="{0:0.0}" CssClass="style1" >
And one more error I had mentioned in the forum “http://forums.infragistics.com/forums/p/65748/332794.aspx#332794” about Right aligning the comment of a cell using CSS, it would be very help full if you could put some light on the same too.
Iam using NetAdvantage 2011.2 for ASP.net
Hi Nikifor,
After enbabling editing on this field, same javascript error occurs..
Is there any solutions on this?
did you try enbabling editing on this field. It crashes then!
Hello Ikram,
Please let me know if you have any further questions regarding this issue.
Hello Ikram,Please take a look at the attached from me sample. Sample was tested with IE 9, FF 10 and Chrome latest. Sample contains WDG with two columns – one integer and one decimal. The second column is decimal and is configured to show 3 numbers after the comma.
Thanks for the help, I made it working by putting the format as below
Width="50px" DataFormatString="{0:n}" CssClass="style1" >
But I am little confused on, how to put the same for 3 decimal places. Right now the above works perfectly for 2 decimal places.