i want to fill a dropdown by a datatable
bcoz i’v already a method GetCate() in bal, which returns datatable and now want to dynamically fill the data into a ddl with some datasource and databind script, could it b possible ???
why does not possible to assign a datatable into a dropdownlist???
public void BindCateDDL()
{
DataTable dt = new BALCate().GetCate();
ddl_filter_category_id.DataSource = dt;
ddl_filter_category_id.DataBind();
}
is this a right way to do this ???
All you have to do is to bind the dropdown to your datatable as follows;