I am开发者_StackOverflow社区 getting int values from the stored procedure. But when i bind this datasource with the gridview i am seeing the values being converted into float. i am using Text='<% # Bind("Quantity") %'
I wanna that to be displayed as int, with out zero's eg: let the value be 233, when i bind that its getting displayed as 233.00try this:
Text='<%# Bind("Quantity", "{0:0}") %>'
This link has a pretty complete list and explanation of the string formatting codes. They can be goofy sometimes, say with the double.ToString(formatCode) method:
var a = 12344.00;
Console.WriteLine(a.ToString("0"));
Outputs the same as this in binding syntax
Eval(12344.00, "{0:0}")
精彩评论