I am binding the dropdownlist with some data and display the selected data in dropdownlist also. That works fine with the following code.
@Html.DropDownListFor(modelItem => item.UniformCommentSelected,
new SelectList(item.UniformComment),
item.UniformCommentSelected)
Now I want to add default message “Select” for dropdownlist.
I also want to show the selected value in dropdownlist if any and “Select” if not.
If I put “Select” as third parameter in DropDownListFor then it display “Select” for all users. If I put “Select” as 4th parameter in dropdownlist then nothing happens.
Can any one help me?
Try to use the following code.