asp.net mvc - MVC DropDownList with Enum Text & Value -


i want set values of dropdownlist 1, 2, 3, 4 , etc. & text january, february, etc.

following code:-

public enum inputmonths     {         january = 1,         february = 2,         march = 3,         april = 4,         may = 5,         june = 6,         july = 7,         august = 8,         september = 9,         october = 10,         november = 11,         december = 12     }  @html.dropdownlistfor(model => model.applymonth, enum.getnames(typeof(models.inputmonths)).select(e => new selectlistitem { text = e, value = e }), "-- select month --", new { @class = "form-control", @id = "applymonth" }) 

what should put in place of value = e values of dropdown list should show 1, 2, 3...

currently dropdown values show january, february, march.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -