<asp:DataList ID="DataList1" runat="server">
            <ItemTemplate>
                <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.RegionDescription") %>'></asp:Label>
            </ItemTemplate>
        </asp:DataList>
---
在DataList控件中添加Label控件后,使用DataBinder.Eval将数据绑定到Label的Text属性,请问高手DataBinder.Eval(Container,"DataItem.RegionDescription")在本文中该如何解释?此方法中的两个参数该怎么理解?

解决方案 »

  1.   

    1)     container.item          the   collection   of   the   container   
    2)     datacolumnname          in   the   container     
    3)     type                    the   format   type   you   want   to   convert
      

  2.   

    Container 是一个局部变量,指向当前控件的父容器对象DataBinder 是一个类,记忆中似乎是 System.Web.UI.DataBinderEval是DataBinder类的一个静态方法,有2个重载,上面你写的2参数的重载,返回值是一个object 。第2个参数是一个绑定表达式