开发者

ASP.MVC2 Editor Templates missing additional html attributes

开发者 https://www.devze.com 2023-02-27 01:31 出处:网络
i\'m using asp.net mvc2 and i what to create my own editor template for example to apply to my DateTyme properties.

i'm using asp.net mvc2 and i what to create my own editor template for example to apply to my DateTyme properties.

in View I call my template by this way:

<%=Html.EditorFor(Function(o) o.DataInicio, New With {.class = "defaultTextBox", .maxlength = "16", .style = "width:120px;"})%>

and it works, because i've created my custom template for this porpose, like this:

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<input type="text" id="<%=viewdata.ModelMetadata.PropertyName %>" name="<%=viewdata.ModelMetadata.PropertyName %>" value="<%=CDate(model).ToString("yyyy-MM-dd") %>"  />

But the problem comes when i need to retrieve the "AdicionalViewDataObject", becauseon the action i've added some data to the viewdata and on this context (editorTemplate) i don't know how to distinguish the additionalviewdataobject from the previous added data on view开发者_Go百科data.

on this case is suposed to add the attribures to my final html, that i've passed in html.EditorFor method.

can anyone helpme with that?


You may checkout the following article about using additional html attributes with editor templates.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号