如何绑定列表<&诠释GT;到GridView? [英] How to bind a List<Int> to a gridview?

查看:118
本文介绍了如何绑定列表<&诠释GT;到GridView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个相当奇怪的问题,因为通常人们只绑定复杂类型到GridView。但是,我需要绑定Int的列表(同样是字符串)。
一般,以结合一种财产使用对象,但使用一个整数,或字符串时的属性的名称,值是完全相同的对象本身,而不是一个属性

This might be quite a strange question since usually people bind only complex types to a gridview. But I need to bind a List of Int (the same is for strings). Usually, as the property to bind one uses the name of the property of the object, but when using a Int or a String, the value is exactly the object itself, not a property.

什么是名,以获取对象的价值?我试图值,(空),本,项,但没有运气。

What is the "name" to get the value of the object? I tried "Value", "" (empty), "this", "item" but no luck.

我指的是一个GridView Web表单。

I'm referring to a gridview in a web form.

更新

有一个相关的堆栈溢出问题的 如何绑定列表到GridView

There's a related Stack Overflow question, How to bind a List to a GridView.

推荐答案

<!的BoundField的DataField = /方式> 可以做的伎俩(!,因为 BoundField.ThisEx pression 等于)

<BoundField DataField="!" /> may do the trick (since BoundField.ThisExpression equals "!").

这篇关于如何绑定列表&LT;&诠释GT;到GridView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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