Click here to Skip to main content
15,885,952 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have model calender as following :

C#
[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]
       // [StringLength(50)]
        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 :

C#
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:

C#
How to represent multiple field in drop down in same time
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900