I want to generate a drop down list for some attributes of my model class. I’m working on an mvc .net application and i’m using razor engine for views. Here is my class :
public class present
{
public DateTime jour { get; set; }
public int entree_mat_h { get; set; }
public int entree_mid_h { get; set; }
public int sortie_mat_h { get; set; }
public int sortie_mid_h { get; set; }
public int entree_mat_m { get; set; }
public int entree_mid_m { get; set; }
public int sortie_mat_m { get; set; }
public int sortie_mid_m { get; set; }
public string mac { get; set; }
public string ip { get; set; }
}
For example, i want to show a drop down list with values from 0 to 60 for each attribute that is an integer.
Does @html.dropdownlistfor() work in this case?
In your view declare list of possible values, in your case from 0 to 60
Then, you can use it in
DropDownListForhelper