0

I like the way MVC4 manage the new logon screen: it is possible to have a modal dialog showed.

enter image description here

I tried to reproduce the same behavior in the same solution for another view. But it doesn't work because Request.QueryString["content"] is null. I don't know why. In fact, there is an action method called ContextDependentView (generated by the MVC template) where the trick occurred. Here it is:

    private ActionResult ContextDependentView()
    {
        string actionName = ControllerContext.RouteData.GetRequiredString("action");
        if (Request.QueryString["content"] != null)
        {
            ViewBag.FormAction = "Json" + actionName;
            return PartialView();
        }
        else
        {
            ViewBag.FormAction = actionName;
            return View();
        }
    }

If the value of Request.QueryString["content"] is not null then we display a partial view (modal jQuery) otherwise it is a classic view.

Can someone help me understand why this is not working?

PS: another thread already exists but without any solution.

4

1 回答 1

2

登录和注册链接绑定到 AjaxLogin.js 中的单击处理程序,然后在 loadAndShowDialog 中添加 content=1

于 2012-02-26T06:14:23.093 回答