![]() |
Карта сайта Интеллектуальная поисковая система![]() Поисковая система v3.kz поможет ускорить индексацию вашего сайта выводит в Топ |
|
public class Foo { public static RouteValueDictionary AnonymousObjectToHtmlAttributes(object htmlAttributes) {. Just tries this with the attribute data_bind and the output was data_bind as opposed to the expected, data-bind - any ideas? foo.HtmlAttributes(new { data_bind = "foo"}); In all the MVC HtmlHelpers I have used the underscore as a hyphen, this would output valid html "data-bind". This doesnt seem to work with attributes like data_bind – SimonGates May 22 13 at 12:05. add a comment . Remember that the actual parameter is for additional view data, so what this does is essentially add the key ViewData["htmlAttributes"] with the value set to the anonymous object that contains the class you want set. EditorFor, now, looks for this key and will add the appropriate HTML attributes in its default... Most of the Html helpers available in ASP.Net MVC have overloads with object htmlAttributes. I have declared a property on my Model to handle html attributes, In short; public IDictionary<string,object> HtmlAttributes { get; set Type: System.Object An object that contains the HTML attributes to set for the element. likewise we need to have data-bind attribute for all fields. Now if you change value in your object, it will be reflected in the UI and vice-versa. There is no such overload of LabelFor helper which accepts htmlAttributes parameter like other html helpers accept. Информация взята v3.kz |
загрузка...
|