首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

异常: 在选定的数据源上未找到名为“PaperState”的字段或属性

2012-05-29 
错误: 在选定的数据源上未找到名为“PaperState”的字段或属性。相关内容:一个在线考试系统的试卷评阅。异常详

错误: 在选定的数据源上未找到名为“PaperState”的字段或属性。
相关内容:一个在线考试系统的试卷评阅。

异常详细信息: System.Web.HttpException: 在选定的数据源上未找到名为“PaperState”的字段或属性。

aspx: 

<asp:BoundField HeaderText="是否评阅"DataField="PaperState"/> 

cs:
 protected void InitData()
  {
  Paper paper = new Paper();
  DataSet ds = paper.QueryUserPaperList();
  GridView1.DataSource = ds;
  GridView1.DataBind();
  LabelPageInfo.Text = "当前(第" + (GridView1.PageIndex + 1).ToString() + "页 共" + GridView1.PageCount.ToString() + "页)";
  }


 GridView1.DataBind();这一行不能运行。

[解决办法]
你的数据源中没有PaperState这个字段,你没有select PaperState 出来
[解决办法]

探讨

好像没有。。。aspx内好像是只有
<asp:BoundField HeaderText="是否评阅"DataField="PaperState"/>

但是如果我改成
<asp:TemplateField HeaderText="是否评阅">
<ItemTemplate>
……

热点排行