how to set a default selected value if my value from my setting is the same as it is from my select list
as with
@{
var pstSelect = (SelectList)ViewData["Printerlist"];
pstSelect.ForEach(o =>
{
if (o.Value== setting.printerName )
{
o.Selected = true;
}
});
}
@Html.DropDownListFor(m => setting.printerName , pstSelect)
i gets
CS1061: 'SelectList' does not contain a definition for 'ForEach' and no extension method 'ForEach' accepting a first argument of type 'SelectList' could be found (are you missing a using directive or an assembly reference?)
so how do i do this probably