In my current project, I had to render elements in the view based on a setting provided by the model(basically it is a configurable thing). Few clients need view element to be rendered in a particular order and few others in a different way. What we did was, saved this elements order in a settings file which could be changed based on the clients. Then created an extension to render this based on the order.
This is what was I was trying to explain. for Client 1 the Login section to be displayed first followed by Password reminder section
For Client 2 , these sections needs be ordered differently
In order to achieve this, I came up with an HtmlHelper
extension
1 | /// <summary> |
In the view, you could do
1 | <% Html.OrderBy(this.Model.LoginDisplayOrder, (html) => { %> |
Here Model.LoginDisplayOrder
is just an array of integers in which the items to be rendered.
Hope this will help.