我試圖在link中做計算,但它說輸入字符串的格式不正確。我正在gridview中計算單元格的值。 這裏是我的代碼:輸入字符串在格單元格的gridview計算中的格式不正確
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();
}
}
在哪條線上? e.Row.Cells [3] .Text','e.Row.Cells [4] .Text'和'e.Row.Cells [5] .Text'的值究竟是什麼? –
這些行是文本框。我將計算我將在那輸入的值。 – jelliaes
不知道這些值是不可能的。請提供它們.. –