Wednesday, April 27, 2011

How to bind a datatable to dropdownlist

I have a dropdownlist (my ddl) and I want to bind it to a datatable (myDataTable).   The datatable has two columns departmentNumber and departmentName         

 myddl.DataSource = myDataTable;
 myddl.DataTextField = "departmentName";
 myddl.DataValueField = "departmentNumber";

No comments:

Post a Comment

Comments will appear once they have been approved by the moderator