Hello, I think it's a good practice to create a component that manages the text on the screen.
Example:
namespace IM.Framework.MVC
{
using System;
using System.Text;
using System.Web.Mvc;
public static partial class IMHelper
{
public static MvcHtmlString IMInputDate(this HtmlHelper html, string Id, string Caption, string PlaceHolder, int Size, DateTime Value)
{
var sb = new StringBuilder();
sb.Append(GeraDiv(new string[] { "input-control", "text", "span" + Size.ToString() }));
sb.Append(IMLabel(html, Id, Caption));
sb.Append(String.Format("<input type='text' id='{0}' placeholder='{1}' value='{2}' class='inputPadrao inputDate' />",
Id, PlaceHolder, Value));
sb.Append(FechaTag("div"));
return new MvcHtmlString(sb.ToString());
}
}
}
In the View use instead of
@Html.Raw(item.data.ToString("dd/MM/yyyy"))
use:
@IMHelper.IMInputDate("id_do_campo", "Título", 10, item.data)
Remembering that in IMInputDate I use code that depends on other functions not available here. But the idea is just to give a "Light".