1) Below is the code to bind the values in dropdown list. Lets say the datasource for this drop down list is a DataTable with columns ID and Name
public void PopulateDropDown(DataTable dt)
{
DropDownList1.DataSource = dt;
DropDownList1.DataTextField = "Name";
DropDownList1.DataValueField = "ID";
DropDownList1.DataBind();
}
2. Now to compare the two dropdownlist, you need to compare the there datasource, which in our case is datatable.
public bool AreDataTableMatching(DataTable dt1, DataTable dt2)
{
DataTable dt = new DataTable();
dt = dt1
dt.Merge(dt2);
dt.GetChanges();
if (dt.Rows.Count > 1)
return false;
else
return true
}