How to fill DropDownList control from the Datasource?

 Posted by Rajesh_Kumar on 2/11/2014 | Category: ASP.NET Interview questions | Views: 534 | Points: 40
Answer:

We have to follow 4 steps for populating dropdownlist.

1st step:Attach datasource to dataset.
ddl_project.DataSource = ds_project.

2nd step:assign datatextfield property to column name
ddl_project.DataTextField = "project_name";

3rd step:assign datavaluefield property to column name
ddl_project.DataValueField = "project_id";

4th step:call databind method
ddl_project.DataBind();


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response