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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:09:55+00:00 2026-05-16T20:09:55+00:00

I am working on a website (Asp.net mvc), where I have multiple partial views.

  • 0

I am working on a website (Asp.net mvc), where I have multiple partial views. One of the views is user information and then below there are few other views say books by the user, articles in a given book etc. thats how my controller looks like.

public class UserController : Controller
{

   public ActionResult UserInfo(long userid)
   {
        var model.User = LoadUser(userId);
        return View(model);
   } 

   public ActionResult Books(long userId)
   {
        var model.User = LoadUser(userId);
        model.Books = LoadBooks(userId);

        return View(model);
   } 

   public ActionResult Articles(long bookId)
   {
        var model.User = LoadUserByBookId(bookId);
        model.Book = LoadBook(bookId);
        model.Articles= LoadArticles(bookId);

        return  View(model);
   } 

} 

I have created three partial views for UserInfo, Books and Articles and pass data from a given view. Now you can see with each method things go more complex. I was reading about Html.Action helper which can load individual partial views. But as you can see I need to pass some data from Html.Action helper to the methods so it can load data accordingly for example to load userinfo, I will need to pass userId.

How can I achieve this using this or any other better method. Help will be appreciated.

Regards
Parminder

  • 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-16T20:09:55+00:00Added an answer on May 16, 2026 at 8:09 pm

    It seems to me the that Lance provides the final step of this solution. Obviously, if Html.RenderAction is used as he describes there must be another Controller Action which has already been invoked, since we now Rendering Actions (Partial views) in a larger view.

    What I think you need is a ViewModel which needs to be populated in the main controller action

    public class PageInfo
    {
        public long UserId { get; set; }
        public long BookId { get; set; }
    }
    

    with the main action

    ....
    public ActionResult MainAction()
    {
         // you probably have some logic here that gets the actual userid and bookid
    
         PageInfo theModel = new PageInfo(){UserId = 39894, BookId = 3};
         return View(theModel);
    }
    

    And then in when calling the RenderAction within the MainAction page

    <%: Html.RenderAction("Articles", new { bookId = Model.BookId }) %>
    <%: Html.RenderAction("UserInfo", new { userId = Model.UserId }) %>
    <%: Html.RenderAction("Books", new { userId = Model.UserId }) %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an ASP.NET website which targets desktop browsers. We want to enable
I'm working on an ASP.NET website where I am using an asp:repeater with paging
I am working with asp.net website project that some of pages need authentication. I
Right now I'm working with an ASP.NET website that automatically generates images and stores
I'm working on an ASP.net 3.5 website with MooTools as the AJAX framework. I
I'm working on an asp.net web site. We have to use com interop to
Very often when working on an ASP.NET web site, the options View Code and
I am working on an ASP.NET project which is physically located at C:\Projects\MyStuff\WebSite2. When
I'm working on a website that will switch to a new style on a
We are working on a website for a client that (for once) is expected

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.