【发布时间】:2014-07-08 11:38:51
【问题描述】:
在我的 aspx 中,我有:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="True">
</asp:GridView>
我有一个非常简单的课程:
class ItemTable
{
public ItemTable(string mc, string dt)
{
this.Machinecode = mc;
this.Datetime = dt;
}
string Machinecode { get; set; }
string Datetime { get; set; }
}
在我的代码中我有:
List<ItemTable> infos = new List<ItemTable>();
//Some code for add item in infos...
GridView1.DataSource = infos;
GridView1.DataBind();
但我有这个错误:
ID 为“GridView1”的 GridView 的数据源没有任何属性或属性可用于生成列。确保您的数据源有内容。
我该如何解决这个问题?
【问题讨论】: