I'm trying to understand databinding and am currently binding to a ComboBox, setting the DataTextField and DataValueField. How do I access properties of the datasource that aren't those two fields?
For example:
Lets say I'm creating a DropDownList of employees. Each Employee has three fields (Name, ID, Age).
I programatically bind to this list of Employees, that is created on initial page load, setting my DataTextField equal to name, and DataValueField equal to ID.
I then later in the page, after postback, want to access the Age of the currently selected employee.
How can I do this?
Is it possible to cast my SelectedItem back to an Employee and use its properties? (I've attempted this but had no luck).
Thanks in advance.
Think like a man of action; act like a man of thought.