什么是的Container.DataItem到底是什么? [英] What is Container.DataItem exactly?

查看:101
本文介绍了什么是的Container.DataItem到底是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是的Container.DataItem是什么呢?

What is Container.DataItem exactly?

推荐答案

这篇文章可以帮助你理解。报价:

This article might help you understand. Quote:

那么,什么是这个前pression到底是什么?的<%#%>意味着这是一个
  数据绑定前pression和的Container.DataItem是对的别名
  数据源中的当前项目。换句话说,如果你绑定
  对象的集合的Container.DataItem是,当前的行
  集合。

So what is this expression exactly? The <%# %> means this is a DataBinding expression and Container.DataItem is an alias for the current item in the datasource. In other words, if you are binding to a collection of objects Container.DataItem is the current row of that collection.

<一个href=\"http://weblogs.asp.net/rajbk/archive/2004/07/20/what-s-the-deal-with-databinder-eval-and-container-dataitem.aspx\">This博客条目给出了何时使用帮助。报价:

This blog entry gives help on when to use. Quote:

的Container.DataItem是DataItem的此运行时别名
  在绑定列表中特定项目。对于其中显示10行的网格
  数据,这是从数据源的一行。实际的类型
  DataItem的是由数据源的类型来确定。例如,如果
  数据源是一个数据视图,DataItem的类型是DataRowView的。如果
  数据源的类型是一个字符串数组,类型
  DataItem的是字符串。如果数据源是集合
  强类型的对象(如员工对象)的类型,
  DataItem的是员工。

Container.DataItem is a runtime alias for the DataItem for this specific item in the bound list. For a grid which displays 10 rows of data, this is one row from the datasource. The actual type of DataItem is determined by the type of the datasource. For example, if the datasource is a Dataview, the type of DataItem is DataRowView. If the type of the datasource is an array of strings, the type of DataItem is String. If the datasource is a collection of strongly-typed objects (for example "Employees" objects), the type of DataItem is Employees.

每个这些情况下,需要一个稍微不同的数据绑定
  前pression,与VB和C#之间的进一步差异。

Each of these cases requires a slightly different databinding expression, with further differences between VB and C#.

这篇关于什么是的Container.DataItem到底是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆