ASP.NET如何获取gridview页脚行的值

时间:2013-09-27 01:02:21

标签: asp.net

  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`

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

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

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

中测试它时
Response.Write(gvItems.FooterRow.Cells[2].Text.ToString());

它的工作正常。 顺便说一句它建好了。 非常感谢。

0 个答案:

没有答案