Why .Net databinding does not support for class field?

博客探讨了.Net数据绑定不支持类字段的问题。指出属性网格不显示字段,数据绑定支持局限于属性的原因之一是其围绕PropertyDescriptors构建,而非直接反射。还举例说明DataRowView实现ICustomTypeDescriptor以伪属性呈现列,供ASP.NET数据绑定使用。
1. the property grid does not display fields
2. One of the reasons why data-binding support is limited to properties happens to be the fact that all of data-binding is built around PropertyDescriptors and not on direct reflection. This allows someone to implement ICustomTypeDescriptor to provide a different OM for the purposes of data-binding than the true set of properties present on the CLR type. For example, DataRowView implements ICustomTypeDescriptor to surface its columns as pseudo-properties that are visible to ASP.NET's data-binding infrastructure (such as GridView/DataGrid columns and DataBinder.Eval). Without this, DataRowView would have two properties - DataView and Index (and the second is the only one remotely interesting for data-binding).

For more information, please refer to:
http://www.nikhilk.net/Entry.aspx?id=42

转载于:https://www.cnblogs.com/jeffreytan/archive/2004/10/15/52585.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值