gv控件问题
我想改变满足条件的行的前景色,为什么提示出错?
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