I want to bind dropdownlist to List
,
in code behind.
You can populate the DropDownList with another DataSource, assuming the valid values are in the database. Check out this video:
http://msdn.microsoft.com/en-us/data/cc546554.aspx
It's using an EntityDataSource instead of an ObjectDataSource, but the principle should still work.
If you want a "(none)" type option for null, see section "Converting Null in Template Fields" on this page:
http://msdn.microsoft.com/en-us/library/ms366709.aspx
Specifically:
(none)
Notice the the "AppendDataBoundItems" attribute and the "asp:ListItem" element.