1
Answer

Decimal formatting within Gridview control

Anand Solomon

Anand Solomon

5y
1.8k
1
I have a gridview control with a item template column as
  1. <asp:TemplateField HeaderText="TOTAL FEE">  
  2. <ItemTemplate>  
  3. <asp:Label ID="LTFEE" runat="server" Text=""></asp:Label>  
  4. </ItemTemplate>  
  5. </asp:TemplateField>  
on code behind I want to format the column with indian currency with 2 decimal places. I tried this code in RowDataBound event, but it does not format the column.
  1. (e.Row.FindControl("LTFEE"as Label).Text = string.Format("{0:n2}", DataBinder.Eval(e.Row.DataItem, "TFEE").ToString());
What I did wrong, please help me in this regard Thank u
Answers (1)