I am trying to Load data from Category table into a Bootstrap Drop down list like:
<div class="form-group">
<label for="sel1"></label>
<select class="form-control" id="cat">
<option>Select From The List</option>
@{
DataEntities ctx = new DataEntities();
var cat = ctx.Categories.OrderByDescending(p => p.CategoryName);
foreach (var item in cat)
{
<option>item</option>
}
}
</select>
</div>
but I am getting this is result
the count of item is equal to number of rows in Category table but I am not getting the actual value! What am I doing wrong?
