您的位置:首页 > 大数据 > 人工智能

不包含“DataItem”的定义--问题总结

2008-11-02 21:58 423 查看
编译错误
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

编译错误

说明:
在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。

编译器错误消息:
CS1061:
“System.Web.UI.Page”不包含“DataItem”的定义,并且找不到可接受类型为“System.Web.UI.Page”的第一个参数的扩展方法“DataItem”(是否缺少
using 指令或程序集引用?)

源错误:

行 165:
行 166:
行 167:        <div class="pic" ><a href='E_showEnterprise.aspx?id=<%#DataBinder.Eval(Container.DataItem, "e_id") %> ' target="_blank">
行 168:            <img alt=""  src='../Files/Image/Enterprise/<%# Eval("e_photo") %>'
行 169:                border="0" style="width: 154px" /></a>

源文件:
e:\鱼类\Fish\EBolg\E_enterpriseList.aspx 行: 167

网上摘录:rainstar_8(雨天之星)

在用<%#DataBinder.Eval(Container.DataItem,"字段")%>这种方法绑定数据时应该先用一个服务器数据控件,比如DataList或DataGrid或者repeater,然后在后台代码中绑定这个数据控件,在前台的.aspx文件才能这样子用的,要不然就会提示说的错误:

总结:不要忘记绑定数据时应该先用一个服务器数据控件,比如DataList或DataGrid或者repeater,一定要先放进这些控件才能运行,不然就会出错。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐