我试图在这个链接中进行计算,但它说输入字符串的格式不正确。我正在计算网格视图中单元格的值。这是我的代码:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
int tot = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
decimal medjtot = (Convert.ToInt32(e.Row.Cells[3].Text) * (Convert.ToDecimal(e.Row.Cells[4].Text) / 12)) * Convert.ToDecimal(e.Row.Cells[5].Text);
Label RowTotal = (Label)e.Row.FindControl("Label1");
RowTotal.Text = medjtot.ToString();
}
}