Comma Separator for Crore and Lac in GridView Column (Indian Format)
In order to show a number with comma separator (Indian Format) for Crore and Lac in ASP.NET GridView you have to create a function in cs file.....
public string ConvertToIndianFormat(string text)
{
if (text != "")
{
decimal num = decimal.Parse(text);
return num.ToString("N", new CultureInfo("hi-IN"));
}
else
{
return null;
}
}
In aspx...
<asp:TemplateField HeaderText="Amount" >
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# ConvertToIndianFormat(Eval("Amount").ToString()) %>' >
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
public string ConvertToIndianFormat(string text)
{
if (text != "")
{
decimal num = decimal.Parse(text);
return num.ToString("N", new CultureInfo("hi-IN"));
}
else
{
return null;
}
}
In aspx...
<asp:TemplateField HeaderText="Amount" >
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# ConvertToIndianFormat(Eval("Amount").ToString()) %>' >
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
Comments
Post a Comment