How to create Dropdown List from SQL database table column without using Entity Framwork.
I have Customer table and Branch table in my Database. CustomerID is a Foriegn Key of Branch table.
I want to create Branch Adding form(BranchId,CustomerId,Name) which has CustomerID of registered customers as a Dropdown List.
- public class BranchModel
- {
- public int bid { get; set; }
-
- [Required(ErrorMessage = "Please Select Customer ID !")]
- [DisplayName("Customer ID")]
- public Nullable<int> cid { get; set; }
-
- [Required(ErrorMessage = "Please Enter Branch Name !")]
- [DisplayName("Branch Name")]
- public String name { get; set; }
-
-
- [NotMapped]
- public List CidList { get; set; }
-
- }
Branch Model.
how to create Controller and View