本文介绍了网格控件不显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我可以将列表传递给gridview控件。但它并没有向我显示数据。我把断点看到数据,它很好地分配给数据源。为什么没有显示...





代码示例:



Test.cs

Hi i can pass the list to my gridview control. But it doesn''t show me the data''s. i put breakpoint to see the datas, its assign well to datasource. why its not shown...


Code Sample:

Test.cs

new frmPersonalInfo().FillGrid(new XPCollection<CustomerInfo>(XpoDefault.Session));



frmPersonalInfo.cs


frmPersonalInfo.cs

public void FillGrid<T>(XPCollection<T> collection  )
      {
          IList list = new List<T>();
          foreach (object item in collection)
          {
              list.Add(item);
          }
          gridControl1.DataSource = list;
      }

推荐答案

public void FillGrid<t>(XPCollection<t> collection  )
      {
          IList list = new List<t>();
          foreach (object item in collection)
          {
              list.Add(item);
          }
          gridControl1.DataSource = list;
          gridControl1.DataBind();

      }


这篇关于网格控件不显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 21:38
查看更多