zoukankan      html  css  js  c++  java
  • MVC 载入不同的MasterPage页面

    public class GroupMasterPage : ActionFilterAttribute
        {
            private string _masterName;
            public GroupMasterPage(string masterName)
            {
                _masterName=masterName;
            }
    
    
            public override void OnActionExecuted(ActionExecutedContext filterContext)
            {
                base.OnActionExecuted(filterContext);
    
                var result = filterContext.Result as ViewResult;
                if (result != null)
                {
                    result.MasterName= _masterName;
                }
            }
        }
        [GroupMasterPage("SuccessPage")]
            public ActionResult Index(string orderid,int hotelid,int roomid)
            {
                bool IsSendEbooking =_Biz.GetSendEbooking(hotelid, roomid);
                O_Success Model = new O_Success();
                Model.IsSendEbooking = IsSendEbooking;
                Model.Orderid = orderid;
                
    
                if (IsSendEbooking)
                {
                    Model.ProcessIFrameURL = ConfigHelper.GetConfigValue("OldSystemUrl") + "/cii/order/fax/faxtohotelpreprocess.asp?orderid=" + orderid;
    
                    return View("~/Views/SuccessOrder/OrderProcess/index.cshtml",Model);
                }
                else
                {
                    Model.ProcessOrderUrl = ConfigHelper.GetConfigValue("GroupSuccessUrl") + orderid;
    
                    Model.QuickUrl = string.Format("http://" + UIHelper.GetAuthority().Replace("booking.hotel.", "service.") + "/cii/share/tNetV.asp?module=");
    
                    return View("~/Views/SuccessOrder/OrderView/index.cshtml",Model);
                }
            }


    _ViewStart.cshtml 页面


    @
    using Ctrip.HotelReservation.GroupHotel.Extensions; @{ if ((((RazorView)(this.ViewContext.View))).LayoutPath == "") { if (!Url.GetErrorView()) { Layout = "~/Views/Shared/_Layout.cshtml"; } } else { if (!Url.GetErrorView()) { //GroupMasterPage("SuccessPage") 载入路径为~/Views/Shared/SuccessPage.cshtml 模板页 Layout = (((RazorView)(this.ViewContext.View))).LayoutPath; } } }
  • 相关阅读:
    通过Java获取图片的信息
    防止浏览器缓冲
    InitializingBean,DisposableBean
    php 直接跳出嵌套循环
    个推IGt.BaseTemplate.php,不仅有bug,还有bom头,好恶心!
    【洛谷】2473:[SCOI2008]奖励关【期望DP(倒推)】
    【BZOJ】4720: [Noip2016]换教室
    【BZOJ】4767: 两双手【组合数学】【容斥】【DP】
    【BZOJ】4318: OSU!【期望DP】
    【BZOJ】4985: 评分【DP】
  • 原文地址:https://www.cnblogs.com/kfsmqoo/p/4551554.html
Copyright © 2011-2022 走看看