If I don't know what htmlhelper I want to use during design time.., Then is it appropiate to try to new up an htmlhelper from within the controller once I understand which model I will be using? So can I make from a controller an htmlhelper and add it to a view later that was not marked up to use the model? Like a data driven application? If so is there an example of doing so?
+2
A:
No.
HtmlHelper are extension methods of the MVC.ViewPage and MVC.ViewPage. They cannot be changed inside of a controller.
What you could do is pass a boolean, string, or whatever into your Views and then change the helper based on that.
<% if( Model.IsSomething ) { %>
<%= Html.MyMagicMethod() %>
jfar
2010-09-09 01:00:07