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();
total += decimal.Parse(lbl3.Text);
}
}
在貨幣格式的價值在aspx頁面如何格式化的GridView
<asp:TemplateField HeaderText="Total" HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right" HeaderStyle-Width="120px" HeaderStyle-HorizontalAlign="Right">
我試圖保護無效LineItemGrid_RowDataBound(對象發件人,GridViewRowEventArgs e)上述第{標籤LBL3 =(標籤)e.Row.FindControl( 「lbltotal」); if(lbl3!= null){lbl3.Text = college.Student.Activity [e.Row.RowIndex] .Mark1.ToString(「c」);總數+ = decimal.Parse(lbl3.Text); }它給了我一個錯誤,指出「輸入字符串的格式不正確」。 – Janet 2011-04-16 02:47:51