Html helper在Asp中的内部功能.净MVC



我只想知道asp.net mvc引擎如何生成对应于htmlhelpers的html。例如:

@Html.Textbox("t1",Model.val)

将生成HTML为

<input type="text" value="Model value"/>

我只是想知道这个html是如何在内部生成的

您可以在codeplex上找到它的源代码:

        [SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed", Justification = "The purpose of these helpers is to use default parameters to simplify common usage.")]
        public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value = null, string cssClass = null, string dir = null, bool disabled = false, string id = null, string lang = null, int? maxLength = null, bool readOnly = false, int? size = null, string style = null, int? tabIndex = null, string title = null)
        {
            return htmlHelper.TextBox(
                name,
                value,
                InputAttributes(cssClass, dir, disabled, id, lang, maxLength, readOnly, size, style, tabIndex, title));
        }

http://aspnetwebstack.codeplex.com/SourceControl/latest src/Microsoft.Web.Mvc/Html/HtmlHelperExtensions.cs

最新更新