【问题标题】:Bind Dictionaries to datagridview to appropriate rows将字典绑定到 datagridview 到适当的行
【发布时间】:2013-07-10 20:40:45
【问题描述】:

我正在开发 c# 2.0。我有一些 dictionaries<string,string> 例如:

Dic1={[A, 5,41]}{[B, 3,4]}{[C, 1,1]}{[D, 6,0]}
Dic2={[A, 3,3]}{[D, 11,1]}
Dic3={[B, 9,1]}{[C, 8,91]}

如何将它们绑定到 datagridview 以将适当的键匹配到适当的值,以便查看以下结果:

【问题讨论】:

  • 这个 Dic1 看起来不像 Dictionart
  • 我这样写是为了解释字母是键,数字是值
  • 使用.Net 2.0?哎哟...

标签: c# .net dictionary datagridview


【解决方案1】:

这样的事情应该会有所帮助。我还没有测试过

Dictionary<string, string> dict= new Dictionary<string, string>();
dict.Add("A","102");
dict.Add("B","103");
dict.Add("C","104");

GridView1.DataSource = dict;
GridView1.DataBind();

要获得对显示数据的更多控制,请使用GridView1_RowDataBound 事件。

但是,根据您的图像,您似乎需要某种报告。 如果是这种情况,请使用 crystal reportSSRS

祝你好运。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-25
    • 2019-09-11
    • 1970-01-01
    • 2012-02-09
    • 1970-01-01
    • 2020-03-07
    相关资源
    最近更新 更多