gv控件问题

wjbmbl wjbmbl 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我想改变满足条件的行的前景色,为什么提示出错?

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row .RowType ==DataControlRowType .DataRow )
{
if (Convert .ToInt32 (DataBinder.Eval(e.Row.DataItem, "结账状态")) ==1)
{
e.Row.ForeColor = Color.Blue;
}
}
}

-----错误信息-----

“/WebSite2”应用程序中的服务器错误。
--------------------------------------------------------------------------------

输入字符串的格式不正确。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。

异常详细信息: System.FormatException: 输入字符串的格式不正确。

源错误:


行 48: if(e.Row .RowType ==DataControlRowType .DataRow )
行 49: {
行 50: if (Convert .ToInt32 (DataBinder.Eval(e.Row.DataItem, "结账状态")) ==1)
行 51: {
行 52: e.Row.ForeColor = Color.Blue;


源文件: c:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\WebSites\WebSite2\期末业务\EndTerm.aspx.cs 行: 50
...全文
评论 3
收藏 已收藏
分享
返回顶部
wjbmbl
C# 111,130 成员 642,539 内容