Created
December 17, 2012 10:47
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ public static IHtmlString SkinnedTextBoxFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, InputStyles styles = InputStyles.Normal, int size = 0) { var cssClasses = BuildClasses(styles, "input"); IDictionary<string, object> attrs = new Dictionary<string, object>(); attrs["class"] = cssClasses; if (size > 0) attrs["size"] = size; string format = null; if (typeof (DateTime).IsAssignableFrom(expression.ReturnType)) { attrs["type"] = "date"; format = "{0:yyyy-MM-dd}"; } else if (typeof (TimeSpan).IsAssignableFrom(expression.ReturnType)) { attrs["type"] = "time"; format = "{0:hh':'mm}"; } return html.TextBoxFor(expression, format, attrs); }