I'm using devexpress, and visualstudio 2010. I have LookUpEdit control, where i want to choose value, but display it with the specified format: there is example which i used with buttonEdit:
CurrentEvent.fkVersion = selectedVersion;
m_cVersionButtonEdit.EditValue= CurrentEvent.fkVersion.FormattedProduct;
m_cVersionButtonEdit.Refresh();
"selectedVersion" is an object which i choose in dialog after button press.
now I have to do the same, but using lookupEdit and selecting version from dropDownlist. So question is how to get Selected value?
I am not sure what you are asking about, but the easiest way to get selected value is like this:
public partial class Form1 : Form
{
public class Example
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
}
public List<Example> elist = new List<Example>();
public Form1()
{
InitializeComponent();
for (int i = 0; i < 10; i++)
{
elist.Add(new Example() { Id = i, Name = "Name" + i, Description = "Description " + i });
}
lookUpEdit1.Properties.DataSource = elist;
lookUpEdit1.Properties.DisplayMember = "Name";
}
private void lookUpEdit1_EditValueChanged(object sender, EventArgs e)
{
var item = lookUpEdit1.GetSelectedDataRow() as Example;
}
}