Search code examples
asp.net-mvcasp.net-mvc-3html-helperstrongly-typed-helper

Where is the Source Code for Html.TextBoxFor


I am currently browsing the source code of asp.net mvc 3 I just downloaded from codeplex. I'm particularly interested in seeing the source code of strongly typed Helper methods like TextBoxFor and DropDownListFor but failed to locate them in InputExtensions.cs and elsewhere.

Would someone point out where I can find required code? My purpose is to see how these helper methods add Html 5's data-* attributes to different input elements on the form.


Solution

  • Get reflector (version 6. should be somewhere available for free), open System.Web.Mvc.dll and search for InputExtensions

    or

    Get mvc source code, open in visual studio, and search for InputExtensions

    edit: misread the question..

    I guess you are looking for InputExtensions.cs line: 371

    tagBuilder.MergeAttributes(htmlHelper.GetUnobtrusiveValidationAttributes(name, metadata));