title: MVC3 Html.DisplayFor -- Is it possible to have this control generate an ID?
body: <p>I want to be able to display some text, but also have the text be modifiable via jQuery.</p>
  
  <pre><code>&lt;%= Html.DisplayFor(model =&gt; model.DeviceComponentName)%&gt;
  </code></pre>
  
  <p>If I used EditorFor instead of DisplayFor I would see an ID for the input control. I do not want the value to be editable in that way, though. So, I have made it a DisplayFor, but it does not generate an ID property for the element.</p>
  
  <p>Should I just wrap the DisplayFor in a div and do something like:</p>
  
  <pre><code>&lt;div id="&lt;%= ViewData.TemplateInfo.GetFullHtmlFieldName("DeviceComponentName") %&gt;"&gt;
      &lt;%= Html.DisplayFor(model =&gt; model.DeviceComponentName)%&gt;
  &lt;/div&gt;
  
  $('#DeviceComponentName').text('newValue');
  </code></pre>
  
  <p>Or is there a cleaner way of achieving this?</p>
  
  <p><strong>Update:</strong> Is there a way which doesn't depend on hard-coded strings? Something that ties to the object itself so if my property name changes I'd get a compile error?</p>
  
  <p>Also, I am using this code, but I do not see an ID value appear:</p>
  
  <pre><code>&lt;td class="editableValue"&gt;
      &lt;%--Label should be editable, so it needs an ID, but only will be edited by jQuery so it can't be an EditorFor--%&gt;
      &lt;%= Html.DisplayFor(model =&gt; model.DeviceComponentName, new { id = "DeviceComponentName" })%&gt;
      &lt;button type="button" id="ComponentTreeButton" class="nestedDialogButton"&gt;...&lt;/button&gt;
  &lt;/td&gt;
  </code></pre>