Saturday, September 29, 2007

Bind dorop down to dataset object easyly

private void BindDropDowns(string dataTextField, string dataValueField, DataSet ds, DropDownList dropDownListID)
{
try
{

dropDownListID.DataSource = ds;
dropDownListID.DataTextField = dataTextField;
dropDownListID.DataValueField = dataValueField;
dropDownListID.DataBind();
}

catch (Exception ex)
{

}

}
//To call the method


BindDropDowns("Id", "Id", dsApprovedPickList, ddlPickListNo);

No comments: