MVC2

http://www.cftea.com/c/2009/04/N8V5CO6JNQCBSZOC.asp   //mvc 学习网站例子

http://www.cnblogs.com/andy1027/archive/2009/04/07/1430956.html

http://msdn.microsoft.com/en-us/library/dd394709.aspx   //mvc2 msdn 官方学习网址

 http://www.cnblogs.com/cdts_change/category/262208.html   //cnblogs mvc 类似书鹏视频的书面,简写版本 is he

http://www.cnblogs.com/jasenkin/archive/2010/08/23/mvc_execute_process.html   对mvc2的简短理解  cnblogs 王胜

 /{controller}/{action}/{id}.  此url在mvc中传递格式是,{controller}:mvc中的controller。{action}:controller中对应的方法名,{id}:默认为方法的参数不用想url中方法后加?号,可以直接用“/”代表,例如:Maps/Detials/3.

 http://www.evget.com/zh-CN/Info/catalog/13527.html  //记录一篇mvc 常用扩展的文章

        "((\(\d{3}\) ?)|(\d{3}-))?\d{3}-\d{4}"  //电话号码正则验证

        [RegularExpression(@"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$",           ErrorMessage = "Invalid email address.")]   // 邮箱正则验证

  In the typical workflow of an MVC Web application, controller action methods handle an incoming Web request. These action methods use the incoming parameter values to execute application code and to retrieve or update data model objects from a database. The methods then select a view that renders a response to a browser.

许官赫

 

Partial Views   -mvc


   partial view enables you to define a view that will be rendered inside a parent view. Partial views are implemented as ASP.NET user controls (.ascx).

When a partial view is instantiated, it gets its own copy of the ViewDataDictionary object that is available to the parent view. The partial view therefore has access to the data of the parent view. However, if the partial view updates the data, those updates affect only the partial view's ViewData object. The parent view's data is not changed.

 

Helper Classes and Members for Rendering Views


  When you create views, many tasks are repetitive or require special MVC framework knowledge. To address these scenarios and to make it easier to render HTML, the MVC framework includes helper classes and members. The design for helper classes is extensible so that you can add custom helper classes and members.

The MVC framework includes the following helpers:

  • Form helpers, which are for form elements such as radio buttons, list boxes, select buttons, text boxes, text areas, hidden content, and password fields.

  • URL helpers, which let you generate URLs for routing.

  • HTML helpers, which include functions to manage HTML strings, such as Encode, Decode, AttributeEncode, and RenderPartial.

You can access code-based rendering helpers by using properties that are added to the ViewPage, ViewUserControl, and ViewMasterPage classes.

 

编辑页面提供post 编辑页保存方法

可以在方法中新增一个参数FormCollection

[AcceptVerbs(HttpVerbs.Post)]

public ActionResult Edit(int id,FormCollection fromValues){//多传递一个参数

Dinner dinner=dinnerRepository.GetDinner(id);

UpdateModel(dinner);//自动绑定来自页面的dinner数据

dinnerRepository.Save();//更新数据

return RedirectToAction("Details",new{id=dinner.DinnerID});//导航到 单条记录的详细页面

//保存方法2   也可以用Request.Form["字段名称"] 例如:Request.Form["Title"];

 

posted @ 2011-11-22 18:28  Lovey  阅读(319)  评论(0)    收藏  举报