随笔分类 - MVC
摘要:1.前台>"%>Indexmodel.OrderId)%>model.UserId)%>model.ReceiverId)%>model.ShopDate)%>model.OrderDate)%>model.ConsigneeRealName)%>model.ConsigneeName)%>model.ConsigneePhone)%>model.ConsigneeProvince)%>model.ConsigneeAddress)%>model.ConsigneeZip)%>model.Consignee
阅读全文
摘要:1.控制器usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Web;usingSystem.Web.Mvc;namespaceMvcfy.Controllers{publicclassAjaxController:Controller{////GET:/Ajax/publicActionResultIndex(){returnView();}publicActionResultGetTime(){returnContent(DateTime.Now.ToString());}}}2.展示页"
阅读全文
摘要:1.Model中分页方法usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Web;usingSystem.Web.Mvc;//命名空间用系统命名空间namespaceSystem.Web.Mvc{publicstaticclassMyHtmlHelperExt{//传一个字符串过来,我给你封装成一个标签:txtpublicstaticstringGetLable(thisHtmlHelperhelper,stringtxt){returnstring.Format(
阅读全文
摘要:namespaceMvcApplication2.Models{//扩展方法三要素:静态类、静态方法、this关键字publicstaticclassMyMethodExt{publicstaticstringGetLable(thisHtmlHelperhelper,stringtxt){returnstring.Format("{0}",txt);}}}前台需要导入命名空间// 这不是必须的剑招:将类命名空间换成 HtmlHelper的命令空间"System.Web.Mvc"这样每个页面都不用再引用命名空间就可以点出来扩展方法。publicstati
阅读全文
摘要:一、控制器总结:①控制器规则约定1.必须以Controller结尾2.控制器下面的所有方法都成为Action,一个动作,其实就是一个请求。3.控制器必须实现IController4.控制器不能使静态类5.控制器指定视图来展示数据的时候,如果没有指定名字,那么就用当前Action的名字作为页面的名字二、Global总结:①Application_Start1.第一次请求来的时候被调用2.而且只能被调用一次,除非appdomain重启3.一般在这里面处理静态的变量4.在这里对全局的所有Application实例的处理,所有的实例都可以收到影响。三、页面跳转总结:①跳转四、html标签总结①view
阅读全文

浙公网安备 33010602011771号