ASP.NET MVC Toolkit - how to use the Html Helper class
2008-01-08 23:27
671 查看
第一次看到ScottGu的MVC系列blog中的代码示例,产生第一个疑惑:
为什么View中的markup都是inline code?!
简直是从优雅的CodeBehide技术的倒退!?
原来MVC"抛弃"了Page,"抛弃"了 <Form runat="server">,"抛弃"了PostBak,"抛弃"了ViewState,抛弃了Page LifeCycle
上面的代码使用了一个Html Helper来构造界面元素,而这个helper并不在ASP.NET 3.5 Extension (CTP) 中。
这个helper来自MVC Toolkit是Rob Conery是作者(blog高产写手!) - 如何快速上手使用这个helper,推荐一篇他的blog: http://blog.wekeroad.com/2007/12/05/aspnet-mvc-preview-using-the-mvc-ui-helpers/
关于inline code VS code behide 的讨论同样来自Rob: http://blog.wekeroad.com/2007/10/15/crazy-talk-inline-scripting-and-code-behind/
为什么View中的markup都是inline code?!
比如一个ListBox: <%=Html.ListBox(“favMovie”,movies,20,true,new string[]{“Say Anything”, “Tron”}) %> <br /> Favorite Songs (Select Shins):<br /> <%=Html.CheckBoxList(“favSongs”,songs,new string[]{“New Slang (Shins)”}) .ToFormattedList(“<li>{0}</li>”) %> <br />
简直是从优雅的CodeBehide技术的倒退!?
原来MVC"抛弃"了Page,"抛弃"了 <Form runat="server">,"抛弃"了PostBak,"抛弃"了ViewState,抛弃了Page LifeCycle
上面的代码使用了一个Html Helper来构造界面元素,而这个helper并不在ASP.NET 3.5 Extension (CTP) 中。
这个helper来自MVC Toolkit是Rob Conery是作者(blog高产写手!) - 如何快速上手使用这个helper,推荐一篇他的blog: http://blog.wekeroad.com/2007/12/05/aspnet-mvc-preview-using-the-mvc-ui-helpers/
关于inline code VS code behide 的讨论同样来自Rob: http://blog.wekeroad.com/2007/10/15/crazy-talk-inline-scripting-and-code-behind/
相关文章推荐
- How to use HTML-5 data-* attributes in ASP.NET MVC
- ASP.NET MVC- VIEW Using the TagBuilder Class to Build HTML Helpers Part 3
- (转)How to use the ASP.NET MVC ModelBinder
- How to create custom html helper in Asp.net MVC 3 or 4
- How to achive the CRUD in ASP.NET MVC(VS2010)
- How to use jquery or ajax to update razor partial view in c#/asp.net for a MVC project
- How to Choose the Best Way to Pass Multiple Models in ASP.NET MVC
- ASP.NET MVC: how to include <span> in link from Html.ActionLink?
- how to use javascript to control the usercotrol in the asp.net
- How to use Asp.Net Mvc ActionFilterAttribute for form authentication
- 【引】How to Choose the Best Way to Pass Multiple Models in ASP.NET MVC
- How to get the Current Controller Name, Action, or ID in ASP.NET MVC
- ASP.NET MVC - how to make users confirm the delete
- How to deploy the ASP.NET MVC 3 website into the IIS7 on Windows server 2008
- How to use FtpWebRequest in asp.net
- ASP.NET MVC HtmlHelper用法大全
- ASP.NET MVC 拓展ActionResult实现Html To Pdf 导出
- Use the MachineKey API to protect values in ASP.NET
- .NET/ASP.NETMVC 深入剖析 Model元数据、HtmlHelper、自定义模板、模板的装饰者模式(三)
- How to bootstrap two angular apps in one asp.net mvc application