Search code examples
c#.netasp.net-mvcasp.net-mvc-4actionlink

why a # character is added to the url?


I have a simple page displaying thumbnail list ,

I want to to add a pager , i have added two action links

  <li class="ui-pagination-next">@Html.ActionLink("Next", "Paginate", "Home", new { nbSkip = ViewBag.nextSkip }, null)</li>

when i click on the link i'm redirected to

http://localhost:41626/#/Home/Paginate?nbSkip=60

instead of

http://localhost:41626/Home/Paginate?nbSkip=60 , 

does anyone know why the '#' character is added to the URL ?

Route copnfig :

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    }
}

Solution

  • From looking at your li class of ui-pagination-next im assuming jQuery Mobile is being used here.

    jQuery Mobile by default, makes your links AJAX enabled


    If you wish, you can prevent this by using:

    $.mobile.ajaxLinksEnabled = false; 
    

    <script type="text/javascript">
       $(function(){
           $.mobile.ajaxLinksEnabled = false; 
       });
    </script>