This is a migrated thread and some comments may be shown as answers.

[Solved] Name cannot be blank, in EditorTemplate

0 Answers 48 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jon Baron
Top achievements
Rank 1
Jon Baron asked on 19 Sep 2012, 02:05 PM
Hey all.

So I know why I'm getting this error: because I'm using ComboBox (not ComboBoxFor), hence no binding and i'm NOT including the .Name("uniqName") method.

So, the InvalidOperationException is a valid one. The problem is, when I do Include the .Name method, JQuery validation no longer works. I had to remove .Name from ComboBoxFor's through-out my application to get this to work, but they are OK because they have model binding and hence get an id/name attribute in mark-up.

I've even tried HtmlAttribute(new {@id = "uniqName"}), same for new { name = "uniqName"}. Tried all 4 (HiddenInput, Input, DropDownHtmlAttribute etc ...

Any help here on how to add the name Attribute, or why using it breaks JQuery validation would rock.

Thanks!
Tags
ComboBox
Asked by
Jon Baron
Top achievements
Rank 1
Share this question
or