Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7178839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:00:06+00:00 2026-05-28T17:00:06+00:00

I was using Ajax.Pager in MVC 2 which worked fine.Here is the code in

  • 0

I was using Ajax.Pager in MVC 2 which worked fine.Here is the code in the view

<%= Ajax.Pager(new AjaxOptions { UpdateTargetId = ViewData.Model.UpdateTargetId, OnBegin = "beginPagings", OnSuccess = "successPagings", OnFailure = "failurePaging" },
        ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { controller = ViewContext.Controller.ControllerContext.RouteData.Values["Controller"], action = ViewContext.Controller.ControllerContext.RouteData.Values["action"], Id = ViewContext.Controller.ControllerContext.RouteData.Values["id"], str = ViewContext.Controller.ControllerContext.RouteData.Values["str"] })%>

and this is the AJax link builder code

private MvcHtmlString GeneratePageLink(string linkText, int pageNumber)
        {
            var pageLinkValueDictionary = new RouteValueDictionary(this.linkWithoutPageValuesDictionary);
            pageLinkValueDictionary.Add("page", pageNumber);

            return ajaxHelper.ActionLink(linkText, pageLinkValueDictionary["action"].ToString(), pageLinkValueDictionary, ajaxOptions);
        }

But now when I upgrade to MVC 4 this is not generating links as expected.

Here is the MVC 4 code I use in the view

@Ajax.Pager(new AjaxOptions { UpdateTargetId = Model.UpdateTargetId, OnBegin = "beginPagings", OnSuccess = "successPagings", OnFailure = "failurePaging" },
        Model.PageSize, Model.PageNumber, Model.TotalItemCount, new { controller = ViewContext.Controller.ControllerContext.RouteData.Values["Controller"], action = ViewContext.Controller.ControllerContext.RouteData.Values["action"], Id = ViewContext.Controller.ControllerContext.RouteData.Values["id"], str = ViewContext.Controller.ControllerContext.RouteData.Values["str"] })

But the link generated is like below and its no more a link. Its rendered as plain text.

<a data-ajax="true" data-ajax-begin="beginPagings" data-ajax-failure="failurePaging" data-ajax-mode="replace" data-ajax-success="successPagings" data-ajax-update="#divGrid" href="">2</a>

I came across a article which says its because of “unobtrusive Javascript”.
Am I missing something??

This issue may be linked to a similar issue in stack overflow

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:00:07+00:00Added an answer on May 28, 2026 at 5:00 pm

    This worked by using

    @Html.Raw()
    
    @Html.Raw(Ajax.Pager(new AjaxOptions { UpdateTargetId = Model.UpdateTargetId, OnBegin = "beginPagings", OnSuccess = "successPagings", OnFailure = "failurePaging" },
            Model.PageSize, Model.PageNumber, Model.TotalItemCount, new { controller = ViewContext.Controller.ControllerContext.RouteData.Values["Controller"], action = ViewContext.Controller.ControllerContext.RouteData.Values["action"], Id = ViewContext.Controller.ControllerContext.RouteData.Values["id"], str = ViewContext.Controller.ControllerContext.RouteData.Values["str"] }))
    

    Now the text is rendered as links..

    Justin’s answer helped me..Thanks Justin.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an MVC masterpage set up which loads a dynamic menu using AJAX
Following is the Javascript function which is using AJAX call in my Spring MVC
I have a jsp page which should load a popup using ajax. The content
I am performing an Ajax submit ASP.Net with MVC : @using (Ajax.BeginForm( action, References,
I have an ASP.Net MVC view which inherits from a ViewModel. The ViewModel contains
I am working in ASP.NET MVC 3 application, I am using razor view. I
I'm using asp mvc 2 and I have a page which has some data
Given an ASP.NET MVC view that generates a table of entries using a for
The solutions here worked fine however they were quite labour intensive. To anyone looking
I am using Visual Studio 2010 and MVC 3 with AJAX/JQuery. The issue I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.