Home >Web Front-end >HTML Tutorial >In HTML, 'Choose which option is selected on pageload of razor Html.DropDownListFor()' is translated into Chinese as 'In Html.DropDownListFor() of Razor, choose which option is selected when the page is loaded?'
The abbreviation is used to determine which option is selected on page load in razor Html.DropDownListFor(). You can try running the following code snippet -
// return Boolean value @Html.DropDownListFor(m => m.Valeur, new List< SelectListItem > { //new list item list item1 is generated new SelectListItem { Value = "0" , Text = "Show", Selected = Model.Valeur == 0 }, new SelectListItem { Value = "1" , Text = "Hide", Selected = Model.Valeur != 0 }, }, new { @class = “selectnew" })
The above is the detailed content of In HTML, 'Choose which option is selected on pageload of razor Html.DropDownListFor()' is translated into Chinese as 'In Html.DropDownListFor() of Razor, choose which option is selected when the page is loaded?'. For more information, please follow other related articles on the PHP Chinese website!