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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:21:53+00:00 2026-05-21T05:21:53+00:00

I have an index view that takes the page parameter like so: /News?page=2 But

  • 0

I have an index view that takes the page parameter like so:

/News?page=2

But in the layout for that view I have this childaction:

@{Html.RenderAction("Index", "Comments", new {page=1, pagesize = 10});}

But the querystring “page” remains 2.. how come? And how to override page for the childaction?

  • 1 1 Answer
  • 1 View
  • 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-21T05:21:54+00:00Added an answer on May 21, 2026 at 5:21 am

    That’s because the child action first looks at the original request query string when binding for values and after that the one passed as argument to the RenderAction helper. You could use a different name for this parameter to avoid this ambiguity.


    UPDATE:

    Unable to reproduce the behavior you are describing.

    Controller:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        [ChildActionOnly]
        public ActionResult Test(string page)
        {
            return Content(page, "text/html");
        }
    }
    

    View (~/Views/Home/Index.cshtml):

    @{Html.RenderAction("Test", "Home", new { page = 1 });}
    

    When querying /Home/Index?page=5 the correct value 1 is shown and the page parameter in the child action is 1.

    Obviously if inside your child action you are fetching this value manually from the request it won’t work but that’s not something you should be doing anyways:

    [ChildActionOnly]
    public ActionResult Test()
    {
        string page = Request["page"] as string;
        return Content(page, "text/html");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that takes a PaginatedList (like in Nerd Dinner sample). The
I have an index view that I want to update automatically as the user
In my rails view(index.html.erb), i have following structure <div> <%= render :partial => create
I have folders and pages /admin/add/index.php, /admin/edit/index.php & /admin/view/index.php which all are requiring page
I have the* Topics * controller and in the view/topics/index.html.erb the link for destroying
I have a view and template called index.html. I have a image which is
I have the following view: @model MyModel1 @{ ViewBag.Title = Index; Layout = ~/Views/Shared/_Layout.cshtml;
I have a strongly-typed Partial View that takes a ProductImage and when it is
I'm working on an app that takes an article (simple HTML page), and a
I am trying to have an element index view displaying the associated projectname (

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.