vendredi 9 novembre 2018

MVC Razor : if else condition inside html textbox element

i am trying to create a condition with MVC Razor with the code below:

@Html.TextBoxFor(m => Model.MyList[i].Value
new { autocomplete = "off", 
spellcheck = "false", data_val = 
Model.MyList[i].IsRequired.ToString().ToLower(), data_val_required = $"The 
field {Model.MyList[i].Description} is required", @: 
if(Model.MyList[i].FieldType == 0) { data_val_number = "Please enter     
`number" } })`

Aucun commentaire:

Enregistrer un commentaire