未将对象引用设置到对象的实例
行126:money1=System.Convert.ToDouble(((Label)GridView1.Rows[i].Cells[5].FindControl("t...
行 126: money1 = System.Convert.ToDouble(((Label)GridView1.Rows[i].Cells[5].FindControl("totalmoney")).Text);
行 127: totalmoney1 = totalmoney1 + money1;
行 128: num1 += 1;
[NullReferenceException: 未将对象引用设置到对象的实例。]
members_Cart.GridView1_RowDataBound(Object sender, GridViewRowEventArgs e) in d:\爱尚巴黎\members\Cart.aspx.cs:126
System.Web.UI.WebControls.GridView.OnRowDataBound(GridViewRowEventArgs e) +108
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +167
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2539
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
这个错误怎么改正。在线等答案。 展开
行 127: totalmoney1 = totalmoney1 + money1;
行 128: num1 += 1;
[NullReferenceException: 未将对象引用设置到对象的实例。]
members_Cart.GridView1_RowDataBound(Object sender, GridViewRowEventArgs e) in d:\爱尚巴黎\members\Cart.aspx.cs:126
System.Web.UI.WebControls.GridView.OnRowDataBound(GridViewRowEventArgs e) +108
System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +167
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2539
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
这个错误怎么改正。在线等答案。 展开
2个回答
展开全部
错误信息已经很详细了,你可以调试((Label)GridView1.Rows[i].Cells[5].FindControl("totalmoney")).Text,在监视窗口里可以看到哪个出现空值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询