I have a gridview with columns like so:
<asp:TemplateField HeaderStyle-Width="75px">
<HeaderTemplate>
<asp:Label ID="lblHM1" Text="Hm1" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblM1" Text='<%# Eval("m1","{0:#0}")%>' runat="server">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
The numbers in this column are often greater than 1000, so I'd like to format them as such. For example, if the data in this column reads 11359, I'd like it to format the number as 11,359.
I have attempted the following:
<asp:TemplateField HeaderStyle-Width="75px">
<HeaderTemplate>
<asp:Label ID="lblHM1" Text="Hm1" runat="server"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblM1" Text='<%# Eval("m1","{0:N0}")%>' runat="server">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
But the above generates an exception: Input string was not in a correct format
What am I doing wrong?