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