I want to create a drop down list with the values of the table categories which has ID and category name into a drop down list using mvc 5.

This is my model for creating the table categories:

namespace DemoIdentity.Models
{
public class CategoriesAdmin
{
    public int ID { get; set; }
    [Required(AllowEmptyStrings = false)]
    [Display(Name = "category name")]
    public string categoryName { get; set; }
}
public class DefaultConnection:DbContext
{
   public DbSet<CategoriesAdmin> categories { get; set; }
}
}

Related posts

Recent Viewed