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 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

I have this jQuery code: $(document).ready(function() { $.ajax({ url: pages/+page+.php, cache: false }).done(function( html
On my main page I have this jquery code which does an ajax call
I have a page that loads content through AJAX. Among this content are some
I have this code below. I randomly ran across that it will work if
I placed all code below. My page works like that Page's first scene When
I have this ajax ConfirmButtonExtender in my page with the ConfirmText set to a
You've seen this - on an ajax-heavy page, like meebo.com, the browser never stops
OK this is an odd error, as it's the first ajax page without any
This relates to my previous post: jQuery .load Method causing page refresh AJAX I
I need help with one ajax function This is raw page setup. Page will

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.