English 中文(简体)
数据网观点方法中具有约束力的数据有何区别?
原标题:What is the difference between binding data in data grid view methods?
  • 时间:2011-01-03 05:46:47
  •  标签:
  • asp.net

数据网观点方法中具有约束力的数据有何区别?

 <ItemTemplate>
    <asp:LinkButton ID="lnkBtnUserName" runat="server" 
   Text= <%# DataBinder.Eval(Container.DataItem,"UserFirstName")%> 
                                            CommandArgument= <%# Eval("UserID") %>  OnClick="lnkBtnUserName_Click" />
                                    </ItemTemplate>

页: 1

 <asp:TemplateField HeaderText="Employee ID">
      <ItemTemplate>
          <asp:Label ID="lblempid" runat="server" Text= <%# Bind("EmpId.EmpId") %> ></asp:Label>
      </ItemTemplate>
</asp:TemplateField>

所用方法

<><>Meod 1

Text= <%# DataBinder.Eval(Container.DataItem,"UserFirstName")%> 
          CommandArgument= <%# Eval("UserID") %>  

<><>Meod 2

Text= <%# Bind("EmpId.EmpId")

是否?

最佳回答

<代码>Eval(“UserID”)对应于<代码>TemplateControl>。 Eval方法称呼,这本身实际上转化为电话,例如<代码>DataBinder。 Eval(GetDataItem)(UserID)。 简言之,Eval是数据Binder的短视。 等到底——内部检查第一种论点,并依据其类型,它将试图解决第二个论点——例如,数据浏览,它将试图在平原物体上填写一栏名称,它将利用反思解决财产名称问题。

<代码>Bind是特殊合成物,在编辑时采用双向约束制,即控制将从数据来源(相当于Eval)获得价值,还将更新(经修改)数据来源的价值。 AFAIK, Bind与一种称为(作为Eval)的方法不一致,而是与伙伴关系。 该网络的汇编者将产生必要的代码,以确保数据具有两种约束力。

见数据约束性表述概述:

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签