I'm passing an XElement to my Edit view and want to have the usual HTML controls built for me and correctly named. The code I have is:
...
<div class="editor-label">
<%= Html.LabelFor(model => Model.XPathSelectElement("site[@id = 'customerName']").Value)%>
</div>
<div class="editor-field">
<%= Html.TextBoxFor(model => Model.XPathSelectElement("site[@id = 'customerName']").Value)%>
<%= Html.ValidationMessageFor(model => Model.XPathSelectElement("site[@id = 'customerName']").Value)%>
</div>
...
But this produces the following:
<div class="editor-label">
<label for="Value">Value</label>
</div>
<div class="editor-field">
<input id="Value" name="Value" type="text" value="" />
</div>
Why is this and how do I get the view to generate sensibly-named (eg) TextBoxes?
Thanks,
Matt.