如何在没有数据源的情况下绑定datagridview [英] How to bind a datagridview without datasource

查看:91
本文介绍了如何在没有数据源的情况下绑定datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一本字典。



我想只显示datagridview中的键而不绑定值。



怎么做

I am having a dictionary.

I want to shown only the keys in the datagridview without binding the values.

How to do so

推荐答案

所以你必须有一个类似于你的 Page_Init中下一个例子的代码( ):

So you have to have a code similar like in the next example in your Page_Init():
_storagePlanDropDownList.DataSource = dictionary;
                   _storagePlanDropDownList.DataValueField = "key";
                   _storagePlanDropDownList.DataTextField = "key";
                   _storagePlanDropDownList.DataBind();


这篇关于如何在没有数据源的情况下绑定datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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