---
title: "How to bind dropdown with Database?"  
description: "How to bind dropdown with Database?"  
author: "Jayden Bell"  
published: 2017-05-18  
updated: 2017-05-18  
canonical: https://www.mindstick.com/forum/34297/how-to-bind-dropdown-with-database  
category: "c#"  
tags: ["c#", "database", "dropdown"]  
reading_time: 1 minute  

---

# How to bind dropdown with Database?

I am having [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) in [binding data](https://www.mindstick.com/forum/4/binding-data-with-datagridview) in [dropdown](https://www.mindstick.com/articles/263/ajax-toolkit-dropdownextender-in-asp-dot-net) with Database. Please help me.

## Replies

### Reply by Manish Kumar

In the controller

```
   public ActionResult Index()        {            //get data from data base             ViewBag.Users =Uow.EmpDetail.SelectAll();                               return View();        } 
```

In the view

```
<fieldset>                                              <legend><strong>Student Info:</strong></legend>                @Html.HiddenFor(x=> x.Id)                Name: @Html.TextAreaFor(x=> x.SName, new { maxlength = "10", style = "width:200px;text-align:center" })<br>                Class: @Html.TextBoxFor(x=> x.Class)<br>                Address:@Html.TextBoxFor(x=> x.Address)<br />                Employee :@Html.DropDownListFor(x=> x.Id,               new SelectList(ViewBag.ListItem, "Value", "Text"))                <input type="submit" value="Submit" />             </fieldset>
```

\

Hope this helps you..

\

\


---

Original Source: https://www.mindstick.com/forum/34297/how-to-bind-dropdown-with-database

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
