views:

35

answers:

0

Hello, I am trying to find a good way to have a dropdownlist by specifying UiHint "DropDown" to the property of the ViewModel and then just using HtmlHelper EditorFor to render the dropdown via an generic EditorTemplate so that it can be used across solutions. I found a very good approach by Tom Schreck Here It works fine. The only thing from keeping it from being perfect is that the dropdownlist is not part of the validation. If I would like to have a "choose" option (added manually in the EditorTemplate) as default and no value is chosen it results in an error. I believe it's because the DropDownList is not created from the DropDownListFor - Helper? I know that Tom wrote that he tried that one, but is there no way of adding items to the SelectList in the loop with the custom values? I cannot do it since I'm a beginner but I think it would be really great if the dropdown could be inlcuded in the validation. This way you could populate the selectList in the controller and keep the same format as the other properties. Sorry for my vocabulary, as I said, I'm a beginner. But I hope you understand what I mean.

I would really appreciate if someone helped me to solve this as I feel I have tried everything..

Regards max