很简单的用过DataBinder.Eval(),知道它很重要,但对它知之甚少,请大家揭开它的神秘面纱吧

解决方案 »

  1.   

    可以进行格式话啊 DataBinder.Eval(Containt.DataItem,"字段",“格式”)
      

  2.   

    数据绑定 <asp:Label id=Label1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ID") %>'></asp:Label>
      

  3.   

    DataBinder.Eval(Container.DataItem,"productname")
    DataBind的共享方法Eval 检查Container.DataItem 为productname查找一个值,运行时将在数据远的
    每一行的每一列中调用这些数据绑定表达式 Eval会把数据远中的任何数据类型转化为一个字符串
    用DataBinder绑订比直接帮订慢了两倍
      

  4.   

    DataBinder.Eval:是什么意思呀?
    Container:是什么?DataItem:是啥东西?
      

  5.   

    我是说能否给个能运行的例子!即给个aspx文件还有它的cs文件
      

  6.   

    实际上它是asp.net内置的一个函数,你在itemcolumn中就绑定的时候就可以看见
      

  7.   

    在运行时使用反射来分析和计算对象的数据绑定表达式。此方法允许 RAD 设计器(如 Visual Studio .NET)轻松地生成和分析数据绑定语法。该方法也可通过声明方式在 Web 窗体页上使用,以简化类型之间的转换。
      

  8.   

    http://chs.gotdotnet.com/quickstart/aspplus/doc/webdatabinding.aspx#bindereval看微软的帮助来的快
      

  9.   

    实际例子
    <asp:DataList ID="DataList1" runat="server" DataKeyField="Aid" Width="170px">
    <itemstyle Height="20px"></itemstyle>
    <itemtemplate>
    <a href ='showlist.aspx?Aid=<%#DataBinder.Eval(Container.DataItem, "Aid")%>' target='_blank'>
    <%#DataBinder.Eval (Container.DataItem, "Atitle")%>
    </a>
    </itemtemplate>
    <headerstyle Height="20px"></headerstyle>
    </asp:DataList>
      

  10.   

    <a href ='showlist.aspx?Aid=<%#DataBinder.Eval(Container.DataItem, "Aid")%>' target='_blank'>
    <%#DataBinder.Eval (Container.DataItem, "Atitle")%>
    </a><a></a>是连接标签,
    href ='showlist.aspx?Aid=<%#DataBinder.Eval(Container.DataItem, "Aid")%>' target='_blank'
    表示一个连接,
    ?Aid表示这个连接要传递一个Aid的值,
    DataBinder.Eval(Container.DataItem, "Aid")把Aid帮定到Container(容器)中的数据项上.从而生成
    .aspx?Aid=Aid值这样一个完整的连接
    _blank表示在新窗口打开下面同理还不明白就没办法了