protected void LineItemGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label lbl3 = (Label)e.Row.FindControl("lbltotal");
if (lbl3 != null)
{
lbl3.Text = college.Student.Activity[e.Row.RowIndex].Mark1.ToString();
total += decimal.Parse(lbl3.Text);
}
}
在aspx页面中
<asp:TemplateField HeaderText="Total" HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="120px" HeaderStyle-HorizontalAlign="Right">
答案 0 :(得分:0)
格式字符串为“c”。
invoicetransmit.Invoice.LineItem[e.Row.RowIndex].TotalNetAmount.ToString("c");
答案 1 :(得分:0)
protected void LineItemGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label lbl3 = (Label)e.Row.FindControl("lbltotal");
if (lbl3 != null)
{
lbl3.Text = college.Student.Activity[e.Row.RowIndex].Mark1.ToString("c");
total += decimal.Parse(college.Student.Activity[e.Row.RowIndex].Mark1.ToString());
}
}