asp.net、c#.net网格视图页脚问题
我在网页中有一个gridviewasp.net、c#.net网格视图页脚问题,asp.net,footer,Asp.net,Footer,我在网页中有一个gridview 它包含列总值的页脚 我在Gridview中有一个列名Production value prod_val nvarchar(50) 对于数据绑定,我使用代码隐藏 protectedvoid grid\u search\u RowDataBound(对象发送方,GridViewRowEventArgs e) { if(e.Row.RowType==DataControlRowType.DataRow) { `tot_prodVal = tot_p
它包含列总值的页脚
我在Gridview中有一个列名Production value
prod_val nvarchar(50)
对于数据绑定,我使用代码隐藏
protectedvoid grid\u search\u RowDataBound(对象发送方,GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControlRowType.DataRow)
{
`tot_prodVal = tot_prodVal + Convert.ToDecimal(e.Row.Cells[2].Text);`
}
}
但它在调试时显示了一个错误
System.FormatException:输入字符串的格式不正确
请给我解决方案。既然您在问题中提到了页脚,我猜您希望在页脚中执行该操作。所以你的条件应该是
e.Row.RowType == DataControlRowType.Footer
我猜是因为您在自己的条件下使用了DataRow,即e.Row.Cells[2]。文本实际上并不指向您希望它指向的字段 请在我的(c#)asp.net网站中显示
prod_val
列的标记。我们允许用户登录时使用id和密码,我希望在另一个网页中查看活动(在线)用户。