Itβs just interesting how and when people use the Editor / Show templates against Html Helpers. In particular, I'm talking about its use in rendering various user interface controls, rather than rendering objects.
For example, I have something like the following atm:
<tr> <th><%= Html.LabelFor(x => x.ActivityTypeId) %></th> <td><%= Html.EditorFor(x => x.ActivityTypeList, "MultiSelectDropDownList")%></td> </tr> <tr> <th><%= Html.LabelFor(x => x.Name) %></th> <td><%= Html.EditorFor(x => x.Name) %></td> </tr> <tr> <th><%= Html.LabelFor(x => x.Description) %></th> <td><%= Html.DisplayFor(x => x.Description, "DisplayString")%></td> </tr>
But lately, I am wondering if I should do this:
<tr> <th><%= Html.LabelFor(x => x.ActivityTypeId) %></th> <td><%= Html.MultiSelectDropDownList(x => x.ActivityTypeList)%></td> </tr> <tr> <th><%= Html.LabelFor(x => x.Name) %></th> <td><%= Html.EditorFor(x => x.Name) %></td> </tr> <tr> <th><%= Html.LabelFor(x => x.Description) %></th> <td><%= Html.DisplayString(x => x.Description)%></td> </tr>
But if I move on to this second option, it makes a lot of sense to use the middle editor for ... I would just use Html.Textbox well and be able to set any html property that I like.
I wonder what patterns people use here ... Any ideas?
Cheers Anthony
asp.net-mvc mvc-editor-templates
vdh_ant
source share