加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

什么是标准的ASP.net数据绑定语法?

发布时间:2020-12-16 03:27:24 所属栏目:asp.Net 来源:网络整理
导读:Microsoft对 data-binding using the asp:Repeater 控件的介绍给出了获取值的语法: b%# DataBinder.Eval(Container.DataItem,"orderid") %/b 此语法在other introductions to the ASP.net Repeater control重复: a href="%# DataBinder.Eval(Container.Dat
Microsoft对 data-binding using the asp:Repeater控件的介绍给出了获取值的语法:

<b><%# DataBinder.Eval(Container.DataItem,"orderid") %></b>

此语法在other introductions to the ASP.net Repeater control重复:

<a href="<%# DataBinder.Eval(Container.DataItem,"URL") %>">...</a>

但我记得这种语法是“坏”和“错误”.从DataBinder.Eval的MSDN文档中我看到:

enter image description here

Note

Because this method performs late-bound evaluation,using reflection at run time,it can cause performance to noticeably slow compared to standard ASP.NET data-binding syntax.

(重点补充)

这就解释了为什么我记得“Eval很糟糕”.但什么是“标准的ASP.NET数据绑定语法”?

奖金阅读

> Data-Binding Expression Syntax

解决方法

我认为你可以做一个演员以避免“后期绑定”惩罚:

<%# (((System.Data.DataRowView)Container.DataItem)["URL"]) %>

现在让我们假设您将性能提高x%.你的申请值得吗?权衡(在我看来)是可读性较差.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读