Initially, the dropdown values are loaded from the model, now it needs to be loaded "static values". so I'm using the below type to load the dropdown for this, I can't able to add the CSS-class. Need advice

 @Html.DropDownList("RoundOffInterval", new List<SelectListItem>
 {
     new SelectListItem{ Text="Select Roundoff Interval",Value=""},
     new SelectListItem{ Text="5",Value = "5" },
     new SelectListItem{ Text="10", Value = "10" },
     new SelectListItem{ Text="15", Value = "15" },
     new SelectListItem{ Text="20", Value = "20" },
     new SelectListItem{ Text="30", Value = "30" }
})

Before I used the below type:

@Html.DropDownListFor(m => m.RoundoffInterval, new SelectList(Model.RoundoffIntervalList, "Id", "Name"), "Select Roundoff Interval ", new { id = "RoundoffInterval", name = "RoundoffInterval", @class = "select2_demo_4 form-control" })

Related posts

Recent Viewed