Question: i want to create Customer diary on the base of customerID that present in customer table[![see the pic](https://i.stack.imgur.com/NRIPG.png)](https://i.stack.imgur.com/NRIPG.png). 

In customerID field i want dropdown list having list of CustomerId's that are present in database

How can i do that ? can someone help me please

Answer: 
```
var _objAllCustomerIds = null; 
using (AdventureWorksEntities context = new AdventureWorksEntities())    
{

_objAllCustomerIds = context.MyCustomers.Select(customer =>     customer.Id).ToList();

}

```

> 
> //where AdventureWorksEntities is your DBcontent containing all your entities
>  //MyCustomers is the entities representation of your customer table
> 
> 
>
if this is in your .aspx file

then in your .aspx.cs file (assuming you're using code behind) you'd get the list of customer IDs and then bind that list to this dropdown.

Does this answer from another question help?
[How to bind the selected value of a DropDownList](https://stackoverflow.com/questions/604186/how-to-bind-the-selected-value-of-a-dropdownlist)