buatlah class person dengan get and set method
public class Person
{
public int ID { get; set; }
public string Name { get; set; }
public int Age { get; set; }
}
protected void SearchWith()
{
var dataSource = new List
new Person(){ ID=0, Name="Budi", Age=27 },
new Person(){ ID=1, Name="Benihime", Age=23 },
new Person(){ ID=2, Name="One Piece", Age=23 },
};
lookUpEdit1.Properties.DataSource = dataSource;
lookUpEdit1.Properties.DisplayMember = "Name";
lookUpEdit1.Properties.ValueMember = "ID";
lookUpEdit1.EditValue = 101; // Select Person with ID==101
lookUpEdit1.EditValue = lookUpEdit1.Properties.GetDataSourceValue("ID", 1);
}
0 comments:
Post a Comment