---
title: "how to fill drop down list in asp.net from database."  
description: "how to fill drop down list in asp.net from database."  
author: "Anonymous User"  
published: 2015-10-30  
updated: 2015-10-30  
canonical: https://www.mindstick.com/forum/33549/how-to-fill-drop-down-list-in-asp-dot-net-from-database  
category: ".net"  
tags: ["c#", "asp.net"]  
reading_time: 1 minute  

---

# how to fill drop down list in asp.net from database.

i want fill [drop down](https://www.mindstick.com/forum/263/drop-down-list-problem) list from [database](https://www.mindstick.com/articles/12226/use-of-database-in-sencha-extjs-and-insert-record-from-user-form-using-ajax) in my [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) application. please give me any solution.

## Replies

### Reply by Anonymous User

Use the DropDownList control to create a single selection [drop](https://www.mindstick.com/forum/159392/how-to-fetch-the-value-of-the-selected-options-in-drop-down-in-php)-down list control. You can control the appearance of the DropDownList control by setting the BorderColor, BorderStyle, and BorderWidth properties.

To specify the items that appear in the **DropDownList** control, place a ListItem element for each entry between the opening and closing tags of the DropDownList control. It is server side control in asp.net.

```
string constr = ConfigurationManager.ConnectionStrings["forumConnectionString"].ToString(); // connection string            SqlConnection con = new SqlConnection(constr);con.Open();            SqlCommand com = new SqlCommand("select *from Employee", con); // table name             SqlDataAdapter da = new SqlDataAdapter(com);            DataSet ds = new DataSet();            da.Fill(ds);  // fill dataset DropDownList1.DataTextField = ds.Tables[0].Columns["Emp_Name"].ToString(); // text field name of table dispalyed in dropdown            DropDownList1.DataValueField = ds.Tables[0].Columns["Emp_ID"].ToString();             // to retrive specific  textfield name             DropDownList1.DataSource = ds.Tables[0];      //assigning datasource to the dropdownlist            DropDownList1.DataBind();  //binding dropdownlist
```

```

```


---

Original Source: https://www.mindstick.com/forum/33549/how-to-fill-drop-down-list-in-asp-dot-net-from-database

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
