protected void ChkPayment_CheckChanged(object sender, EventArgs e)
{
foreach (GridViewRow gvrow in grvPaymentList.Rows)
{
var Selection = gvrow.FindControl("ChkSelected") as CheckBox;
decimal Total=0;
decimal abc=0;
if (Selection.Checked)
{
var moviePrice = gvrow.FindControl("MoviePrice") as Label ;
abc = Convert.ToDecimal(moviePrice.Text);
}
Total = Total + abc;
lblAmount.Text = Total.ToString();
}
}
选中复选框并合计标签中的金额。由于从字符串转换为十进制时出现错误,我该如何实现它。