Most MVC Html helpers allow the caller to specify htmlAttributes as either an anonymous object or an IDictionary<string, object>. This is convenient as it makes it possible to easily merge attributes from different sources.
WebGrid.GetHtml (and WebGrid.Table) only accept an anonymous object.
These methods should be enhanced either by adding appropriate overloads, or by checking for a dictionary, e.g.:
... Table(... object htmlAttributes = null)
{
IDictionary<string, object> dictionary = htmlAttributes as IDictionary<string, object>;
if (dictionary == null && htmlAttributes != null)
{
dictionary = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
}
... etc ...
}
WebGrid.GetHtml (and WebGrid.Table) only accept an anonymous object.
These methods should be enhanced either by adding appropriate overloads, or by checking for a dictionary, e.g.:
... Table(... object htmlAttributes = null)
{
IDictionary<string, object> dictionary = htmlAttributes as IDictionary<string, object>;
if (dictionary == null && htmlAttributes != null)
{
dictionary = HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes);
}
... etc ...
}