Two tables are there
1. Status_Master
2. Role Master
a. Status_Id(Identity,Primary key) a. Role_Id(Identity,Primary key)
b. Status_Desc. b. Role_Desc
c. Remarks c. Status (wants for Dropdown list)
Here Model is [Status_Master_Model] Here Model is [Role_Master_Model]
Question is in [Role_Master_Model] view i have to us Dropdown for column c i.e (Status) an d bind the value from [Status_Master_Model] for column b i.e (Status_Desc.)
Help me with codes....as i am doing in [Role_Master_Model]..[@Html.TextBoxFor(m => m.Status) ]..as stated in red one..errror is coming as [Role_Master_Model] does not contain its defination
Kunal GuptaPosted Jul 19, 2016, 5:35 AM
Kunal GuptaPosted Jul 19, 2016, 2:38 AM
{
FTSdatabaseEntities dc = new FTSdatabaseEntities();
{
ViewBag.Status_Description = new SelectList(dc.Status_Master_Table, "StatusId", "Status_Description", "Remarks");
var query = (from Status_Description in dc.Status_Master_Table
select Status_Description).ToList();
List
foreach (var item in query)
{
listOfDiscs.Add(item.Status_Description);
dc.SaveChanges();
}
ViewBag.ListOfDisciplines = listOfDiscs;
return View();
}
}
Hima BinduPosted Jul 18, 2016, 7:20 AM
To bind DDL in MVC
http://stackoverflow.com/questions/6333270/populate-html-dropdownlist-with-a-liststring-using-mvc