zoukankan      html  css  js  c++  java
  • 不包含“DataItem”的定义问题总结

    编译错误 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=" 154px" /></a>

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

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

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

    总结:不要忘记绑定数据时应该先用一个服务器数据控件,比如DataList或DataGrid或者repeater,一定要先放进这些控件才能运行,不然就会出错。

    作者:johnny 出处:http://www.cnblogs.com/sunjunlin 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    Leetcode 233 Number of Digit One
    获取各种常见形状的位图
    关于编程
    LintCode-第k大元素
    基于IBM Bluemix的数据缓存应用实例
    LeakCanary:简单粗暴的内存泄漏检測工具
    MFC,C++,VC++,VS2010 之间究竟是什么关系
    我对高考考场制度(比方是否同意迟到、忘带考证、上厕所)优化的点滴思考,不一定非常有道理
    ural 1989(树状数组+多项式hash)
    TI C66x DSP 系统events及其应用
  • 原文地址:https://www.cnblogs.com/sunjunlin/p/1325054.html
Copyright © 2011-2022 走看看