1
我的問題是這個Telerik的的WinForms RadGridView創建和運行時填寫
非常相似,但我不希望創建數據表
這是網格視圖
GridView = new RadGridView
{
AutoSizeRows = true,
BeginEditMode = RadGridViewBeginEditMode.BeginEditProgrammatically,
Location = new Point(0, 130),
Name = "GridView",
ShowRowErrors = false,
Size = new Size(390, 100),
TabIndex = 0,
Visible = false
};
這方法在運行時創建列
private List<GridViewTextBoxColumn> InitializeColumns()
{
var result = new List<GridViewTextBoxColumn>();
{
var columnId = new GridViewTextBoxColumn
{
Name = "RecordID",
HeaderText = "ID",
FieldName = "RecordID",
MaxLength = 50,
Width = 50,
DataType = typeof(int)
};
result.Add(columnId);
}
{
var columnInformation = new GridViewTextBoxColumn
{
Name = "RecordInformation",
HeaderText = "Information",
FieldName = "RecordInformation",
MaxLength = 50,
Width = 250,
DataType = typeof(string)
};
result.Add(columnInformation);
}
{
var columnRowType = new GridViewTextBoxColumn
{
Name = "RecordType",
HeaderText = "Type",
FieldName = "RecordType",
MaxLength = 50,
Width = 250,
DataType = typeof(string)
};
result.Add(columnRowType);
}
return result;
}
這個類是網格行
internal class OrderTripChangedAlertItem
{
public int RecordID { get; set; }
public string RecordInformation { get; set; }
public string RecordType { get; set; }
public OrderTripChangedAlertItem(int recordID, string recordInformation, string recordType)
{
RecordID = recordID;
RecordInformation = recordInformation;
RecordType = recordType;
}
}
所以我的列表綁定到網格視圖。列顯示正常,但沒有顯示數據。必須有一個記錄。我錯過了什麼?