Rajesh Kamalakshan
Tuesday, December 5, 2017
Asp.net MVC how to populate dropdown list with numbers
Below Razor code will populate a dropdown with numbers from 1 to 10
@Html
.
DropDownListFor
(
m
=>
m
.
BookRetensionDays
,
Enumerable
.
Range
(
1
,
10
).
Select
(
rd
=>
new
SelectListItem
{
Text
=
rd
.
ToString
(),
Value
=
rd
.
ToString
()
}))
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment