I am trying to call the following Editor method from my helper class:
public EditorExtensions {
public static MvcHtmlString Editor(this HtmlHelper html, string expression, string templateName, object additionalViewData);
}
An example of a call would be:
this.Html.Editor("Name", "TemplateName", new { PropertyId = "Property1" });
This works perfectly fine, until I try to pass a dynamically generated object as the additionalViewData parameter, like an ExpandoObject. The reason why it doesn't work is that the .NET framework will try to do a GetProperties() on the passed Object and ExpandoObject won't retrieve the correct properties as the properties I'm creating at runtime weren't compiled at compile time.
How do I pass dynamically generated information into the additionalViewData parameter?