Feb 28, 2012, 2:15 PM
GridPanel - Set Selection Not On ID - but on Other Store field?
Based upon the results of a datatable - I am trying to set the selection of a gridpanel - works great if the value in row[0] is equal to the store reader id - but in this case - in place of the below - is there a way that I can take a value from the datatable and match it to a specific field in the store/gridpanel - in this case, I have a field called AccountNumber - so if the returned row from the datatable matches field AccountNumber - then select...?
So - In a simplified model of the dataset - in place of "ID" - I want to set selection based upon "Test"
foreach (DataRow row in dt.Rows) // Loop over the rows.
{
sm4.SelectedRows.Add(new SelectedRow(row[0].ToString()));
}
So - In a simplified model of the dataset - in place of "ID" - I want to set selection based upon "Test"
protected void LoadData()
{
Store store = this.GridPanel1.GetStore();
store.DataSource = new object[]
{
new SomeClass()
{
ID = "id1",
Test = "test1"
},
new SomeClass()
{
ID = "id2",
Test = "test2"
},
new SomeClass()
{
ID = "id3",
Test = "test3"
}
};
store.DataBind();
}
Last edited by Tbaseflug; Feb 28, 2012 at 3:07 PM.