0

I navigate from one mobile page to another, the page appears but the controls on the page

won't appears, i am using jquery mobile and mvc 3 with razor here is my code

Main Navigation Link controller for action.

public ActionResult List()
{
    if (Request.Browser.IsMobileDevice)
    {
        return View("List");
    }
    else
        return View("ListM");
}

View for link which will navigate the File controller

@{
    Page.Title = "ListM";
    Layout = "~/Views/Shared/_LayoutMob.cshtml";
}
<div>
    <ul data-role="listview" >    
        <li>
            @Html.ActionLink("FileLink", "List", "File")
        </li>
    </ul>
</div>

this is the _LayoutMob.cshtml Page(just like master)

<!DOCTYPE html>
@using DomainModel.Extentions;
<html lang="en">
    <head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
    <script src="http://code.jquery.com/jquery-1.5.min.js"></script>    
    <script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
    <style type="text/css">
    body { background: #dddddd;} 
    .gmap { height: 330px; width: 100%; margin: 0px; padding: 0px }
    </style>

    </head>
    <body data-role="page" data-theme="e"> 
        @RenderBody()
    </body>
</html>

This is for the Controller(i.e the link where the navigation should come)

public ActionResult List()
{
    if (Request.Browser.IsMobileDevice)
    {  
        return View("ListM");
    }
}

Browser i am using are Mozilla Firefox,IE8 and iBB Demo2.

1
  • what happens if the Request.Browser.IsMobileDevice is false? Also do you have a view for each route, List and ListM either located in the View directory linked with the associated controller or in the Shared directory? Commented Mar 2, 2011 at 13:51

1 Answer 1

2

should this

public ActionResult List()
{
    if (Request.Browser.IsMobileDevice)
    {
        return View("List");
    }
    else
        return View("ListM");
}

be this

public ActionResult List()
{
    if (Request.Browser.IsMobileDevice)
    {
        return View("ListM");
    }
    else
        return View("List");
}

?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.