Method:
protected void
LoadDropDownList(DropDownList ddl, object ds, string vf,
string tf)
{
ddl.DataSource = ds;
ddl.DataValueField = vf;
ddl.DataTextField = tf;
ddl.DataBind();
ddl.Items.Insert(0, new ListItem("--Select--",
"0"));
}
How to call this method:
LoadDropDownList(ddlRegion, r.GetAll(), "RegionID", "RegionName");