public class ANote{
public string NoteId = "";
public string Note = "";
public string NoteCollector = "";
public DateTime NoteCollectionDate = DateTime.MinValue;
public string NoteCollectionDay {
get { return NoteCollectionDate.toString("MM/dd/yyyy") ; }
}
public string NoteCollectionTime {
get { return return NoteCollectionDate.toString("hh/mm tt"); }
}
public DateTime ADate = DateTime.Now;
public double AAmount = 0.0D;
public string AName = "";
}
而一个的BindingList ALIST datagridview的转起来;我的一些类<T>的成员不要绑定到的BindingList <T>
也有一堆DataGridTExtBoxColumns,我尝试绑定到象上面(已填充)名单的网格:
colDate.DataPropertyName ="NoteCollectionDay";
colTime.DataPropertyName = "NoteCollectionTime";
colName.DataPropertyName = "NoteCollector";
colADate.DataPropertyName = "ADate";
colAAmount.DataPropertyName = "AAmount";
colAName.DataPropertyName = "AName";
colNotes.DataPropertyName = "Note";
grdNotes.AutoGenerateColumns = false;
grdNotes.DataSource = aList;
但在运行时,只有我colDate和colTime栏填写正确。所有其他的都是空白的..当我专门查看Grid.Rows[idx].Cells[idx].Value
的其他colmns时,它全部为空。
另外,如果我将AutoGenerateColumns设置为true,则会看到额外的列NoteID,并且也会正确填充,但是,注释,金额,ADate,AName和注释字段仍然为空!
列表中的数据没有问题..所有类成员都有有效值。
除非我失去了一些东西这似乎是一个BindingList或DataGridView的问题..如果不是,任何想法如何调试这..它是一个非常简单的测试用例!
这是c#吗? 我必须在这里添加更多的字符以通过过滤器。 – recursive 2009-09-17 20:14:49