0
  if (_myDs.Tables[_orderItemsName].Rows.Count == 1)
    {
        gvItems.FooterRow.Cells[2].Text = _myDs.Tables[_orderItemsName].Rows[0]["Price"].ToString();
        Response.Write(gvItems.FooterRow.Cells[2].Text.ToString());
        int temp = Convert.ToInt32(gvItems.FooterRow.Cells[2].Text.ToString());
        Response.Write(temp);
    }
    else
    {
        int temp = Convert.ToInt32(gvItems.FooterRow.Cells[2].Text.ToString());
        gvItems.FooterRow.Cells[2].Text = (temp + Convert.ToInt32((lblClothPrice.Text).ToString())).ToString();
        //gvItems.FooterRow.Cells[2].Text = Convert.ToInt32(gvItems.FooterRow.Cells[2].Text.ToString()) + Convert.ToInt32(lblClothPrice.Text.ToString());
    }`enter code here`

嗨,我正在尝试获取页脚第三个单元格中的值,这是一个代表总价的数字,然后在其上添加一些值,但是这个

Convert.ToInt32(gvItems.FooterRow.Cells[2].Text.ToString());

只要给我这个错误“FormatException:输入字符串的格式不正确。” 但是当我测试它时

Response.Write(gvItems.FooterRow.Cells[2].Text.ToString());

它工作正常。顺便说一句,它建得很好。非常感谢。

4

0 回答 0