var lstEMployeeName = EmployeeBL.GetEmployeeName();
ViewBag.EmpDropDown = lstEMployeeName .AsEnumerable().Select(c => new SelectListItem { Text = c.Name.ToString(), Value = c.Id.ToString() }).OrderBy(i => i.Text);
@for (int item = 0; item < Model.EmployeeItemList[item].Count; item++)
{
@Html.DropDownListFor(m => m.EmployeeItemList[item].EmpID, new SelectList(ViewBag.EmpDropDown, "Value", "Text", @Model.EmployeeItemList[item].EmpID), "Select Employee Name", new { @class = "ddl-search panel-data chzn-select-deselect", @style = "width:100%;" })
}
public static List<ForDisplay> GetEmployeeName()
{
using (var entity = new EmpDataEntities())
{
var res = (from comm in entity.tbl_EMployee
select new ForDisplay
{
Id = comm.Id,
Name = comm.Name
}).ToList();
return res;
}
}
public class ForDisplay
{
public int Id { get; set; }
public string Name { get; set; }
public ForDisplay()
{
}
public ForDisplay(int pId, string pName)
{
Id = pId;
Name = pName;
}
}
Tuesday, May 22, 2018
Binding/Selecting Dynamic DropdownList
Subscribe to:
Post Comments (Atom)
javascript Filter/index off
var family = [{"name":"Jack", "age": 26}, {"name":"Jill", "age"...
-
A3+C3 VLOOKUP(G3,$A$3:$B$10,2) sum Product Quantity Count Result 1 Mobile 2 1 Mobile 3 Keyboard 3 2 Mobile 6 TV 1 3 ...
-
EF CORE CLI > dotnet ef database update MyFirstMigration. Scaffold-DbContext Command Use Scaffold-DbContext to create a model based ...
No comments:
Post a Comment