Html.TextBoxFor 的源代码在哪里
我目前正在浏览刚刚从codeplex下载的asp.net mvc 3的源代码。我对查看强类型 Helper 方法(如 TextBoxFor 和 DropDownListFor)的源代码特别感兴趣,但未能在 InputExtensions.cs 和其他地方找到它们。
有人会指出我在哪里可以找到所需的代码吗?我的目的是了解这些辅助方法如何将 Html 5 的 data-* 属性添加到表单上的不同输入元素。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要下载源代码或使用反射器扩展。
如果您“转到定义”(F12),您应该看到文件元数据,它是汇总的方法声明。从那里,将鼠标悬停在选项卡上,您应该看到该方法来自的(本地)文件路径,它也对应于命名空间。这样,您就可以从 Codeplex 上的 MVC 源代码中查找它:
http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/5cb74eb3b2f3#src/System.Web.Mvc/Html/InputExtensions.cs
You don't need to download the source code or use reflector extensions.
If you "go to definition" (F12), you should see the file metadata, which is the summarized method declarations. From there, hover over the tab, and you should see the (local) file path where the method came from, which also corresponds to the namespace. With that, you'll be able to look it up from the MVC source code on Codeplex:
http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/5cb74eb3b2f3#src/System.Web.Mvc/Html/InputExtensions.cs
获取 reflector(版本 6. 应该可以免费获得),打开
System .Web.Mvc.dll
并搜索InputExtensions
或
获取 mvc源代码,在Visual Studio中打开,然后搜索
InputExtensions
编辑:误读问题..
我猜你正在寻找
InputExtensions.cs行:371
Get reflector (version 6. should be somewhere available for free), open
System.Web.Mvc.dll
and search forInputExtensions
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