I am data binding a IQueryable collection of Suppliers to a listbox as follows in my page load event...
SupplierRepository sr = SupplierRepository.GetInstance();
lbSuppliers.DataSource = sr.FindAll();
lbSuppliers.DataTextField = "SupplierName";
lbSuppliers.DataValueField = "SupplierID";
lbSuppliers.DataBind();
But for some reason when I try to get the selectedvalue from the list box as follows it's returning null, even though I can see the values in the html source view at runtime.
lbSuppliers.SelectedValue.ToString();
Seems a very basic problem, but I am stuck. Is this because I am using a EF collection for the data source?