I have model calender as following :
[Table("Calender")]
public partial class Calender
{
public Calender()
{
this.schedule = new List<Schedule>();
}
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Key]
public int DayNum { get; set; }
[Required]
[StringLength(50)]
public string DayName { get; set; }
[Required]
public int FromTime { get; set; }
[Required]
public int ToTime { get; set; }
public bool Active { get; set; }
public virtual ICollection<Schedule> schedule { get; set; }
}
}
I need to show drop down list with
DayName(FromTime-ToTime)
meaning i need to show my format values in drop down as following :
Saturday(2-5)
Sunday(2-4)
Friday(3-5)
as DayName(FromTime-ToTime) inside dropdown
I can represent DayName as following :
ViewBag.DayNum = new SelectList(db.calenders, "DayNum", "DayName");
But cannot represent format DayName(FromTime-ToTime)
How i represent this format in controller and view ?
What I have tried:
How to represent multiple field in drop down in same time