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

  • Home
  • SEARCH
  • 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 3361570
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:10:07+00:00 2026-05-18T03:10:07+00:00

This is my ajax pager code below: Now I want to make sure that

  • 0

This is my ajax pager code below: Now I want to make sure that the link for the current page is unclickable and css should reflect that as well. My pager is keeping track of the current page number, so that is not a problem. The concern is how should I go about making that particular link unclickable and look different (without writing a bunch of crazy if-else blocks)?

 <%if(Model.num_pages > 1){ %>
    <table>
    <tr>
    <td><%=Model.Total%></td>
    <td><%=Ajax.ActionLink("1",
                Model.originalAction, 
                Model.originalController, 
                new { Page = 1, totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId  = Model.carrierId },
                        new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" })%></td>
    <%if (Model.num_pages > 3)
      { %>   
      <td>         
    <%using (Ajax.BeginForm(
                Model.originalAction,
                Model.originalController,
                new {totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId },
                new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" }))
      {%>
    <%=Html.DropDownList("Page", Model.dropDown)%>
    <input value = "jump" type = "submit" />
      <%} %>
      </td>
      <%} %>
      <%else
        {
            for (int i = 2; i < Model.num_pages; i++)
            {%>
           <td>
           <%=Ajax.ActionLink(i.ToString(),
                    Model.originalAction,
                    Model.originalController,
                        new { Page = i, totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId},
                           new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" })%>
          </td>
        <% }
        }%>

    <td><%=Ajax.ActionLink(Model.num_pages.ToString(), 
                  Model.originalAction,
                    Model.originalController,
                new { Page = Model.num_pages, totalNumber = Model.Total, comments = (object)null, divToUpdate = Model.divToUpdate, videoId = Model.carrierId},
                        new AjaxOptions { UpdateTargetId = Model.divToUpdate, OnBegin = "commentBegin", OnComplete = "commentEnd" })%></td>
    </tr>

    </table>
    <%} %>
  • 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-18T03:10:08+00:00Added an answer on May 18, 2026 at 3:10 am

    progtick – i think you’d be better off creating an htmlhelper for this. I’ve done this in the past with great success. basically, it’s a one liner:

    /* the 1st param is your target div
       the 2nd parameter true/false merely indicates whether
       the helper should run in querystring postback or ajax mode
    */
    <%=Html.Pagination("TargetDiv", true) %>
    

    and here’s how it looks (with unreserved apologies to SO for the obvious influence!!):

    alt text

    [update] you can grab a working example of this from here:

    http://www.gatehousemusic.com/downloads/MvcApplication2.1.zip

    let me know how you get on.

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

Sidebar

Related Questions

In the code below I use the jQuery ajax() function to do a longpolling
I am using Jquery AJAX to post a form on my page. I want
I have an anchor tag on my page that toggles between active and cancelled
The below code works as far as I can tell except for the var
I'm using Ajax to dynamically populate a DIV. I have each page content stored
I have a signup form on my home page which uses server side validation
I am pretty new to this, so go easy on me: I am building
How do I attach a handler to the click event of a link, which
I have a collection of divs that contain either images or checkboxes. My end
i am using jquery ui dialog and displaying a form: $(#detailView).dialog({ resizable: false, height:

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.