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 3400096
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:51:03+00:00 2026-05-18T04:51:03+00:00

I have an ascx control for fruits that contains following code: <div id =

  • 0

I have an ascx control for fruits that contains following code:

<div id = "fruits">

....
Ajax stuff1 UpdateTargetId = "fruits"
Ajax stuff2 UpdateTargetId = "fruits"

<%Html.RenderPartial("PagerAjax", (Pager)ViewData["pager"]); %> 
</div>

now this fruit control can appear on a number of webpages and the pager would need to know what page the user is on so that it can pull next set of fruits accordingly. For example, if I am on red-fruit page, then PagerAjax should know I am only pulling out red fruits. So, basically I would need to know ControllerName (assume it’s home) and actionName (assume it’s redFruits()). (Example may seem inefficient but it makes sense for the real purpose.) Now, I could do something like this:

<%Html.RenderAction("PagerAjax", (Pager)ViewData["pager"], ViewContext.RouteData.Values["action"], controllerFilter = ViewContext.RouteData.Values["controller"] }); %> 

However, as you noticed, the above RenderAction is inside the div that is being updated by Ajax callback, which means it will contain action and controller of the Ajax stuff rather than the original URL’s.

What should be an efficient workaround?

  • 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-18T04:51:04+00:00Added an answer on May 18, 2026 at 4:51 am

    You could pass the original ViewContext.RouteData.Values["action"] as parameter when calling your AJAX action. This way the action knows what was the original action and store it in the model (or ViewData as in your case I see that your views are not strongly typed). Now your markup could become:

    <% Html.RenderPartial(
        "PagerAjax", 
        (Pager)ViewData["pager"], 
        new ViewDataDictionary() { { "originalAction", ViewData["originalAction"] } }
    ); %> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have constructed an ASP.NET user control Box.ascx wtih the following code. <div id=divContent
I have LogOn.ascx control which is located on master page site.master: <% Html.RenderPartial(LogOn); %>
I have an ASCX control that has to render Silverlight dynamically. The dynamic code
In a particular page i have a ascx control which contains a table. Now
I have a User control(ascx) that has an Update panel. When the page is
I have an ascx control which contains dropdownboxes I want to be able to
I have a custom ASCX control that is not visible in design mode in
I have an ascx control; <%@ Control Language=C# AutoEventWireup=true CodeBehind=LanguageSelect.ascx.cs Inherits=MyNamespace.LanguageSelect %> with code
I have a user control that I'm adding to a webpage dynamically. The ascx
I have the following function that updates the UpdatePanel content by adding/loading an ascx

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.