c# - DropDownListfor in EditorTemplates -


am creating editortemplate boolean fields have yes no dropdown , below code

@model nullable<bool>  @{     var listitems = new[]     {         new selectlistitem { value = "true", text = "yes" },         new selectlistitem { value = "false", text = "no" }     };  }      @html.dropdownlistfor( ????, listitems,"") 

where want load drop-down selected item available in model can true or false

from view getting true or false in model property template. how can use dropdownfor accepts linq in 1st paramtere ?

thanks

you can either use

@html.dropdownlistfor(m => m, listitems, "") 

or

@html.dropdownlist("", listitems, "") 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -