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.

Johnie Karr
  • 2,744
  • 2
  • 35
  • 44
Bronzato
  • 9,438
  • 29
  • 120
  • 212
  • 1
    follow the instructions on this link to fix your problem: http://stackoverflow.com/questions/9763013/asp-net-mvc-4-jquery-dialogs – Vijay V Apr 13 '12 at 20:13

1 Answers1

2

The login and register links are bound to a click handler in AjaxLogin.js which then adds content=1 in loadAndShowDialog

Allusion
  • 21
  • 2