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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:23+00:00 2026-05-26T22:41:23+00:00

I want to render a partial view as follows: The viewModel for book.cshtml looks

  • 0

I want to render a partial view as follows:

The viewModel for book.cshtml looks like:
public class EditViewModel
{
    public Status Status { get; set; }
    public Book Book { get; set; }
}
In the book.cshtml file:
@{ Html.RenderPartial("~/Views/Shared/_Tracking.cshtml", Model.Book); }

and

The viewModel for magazine.cshtml looks like:
public class EditViewModel
{
    public Status Status { get; set; }
    public Magazine Magazine { get; set; }
}
In the magazine.cshtml file:
@{ Html.RenderPartial("~/Views/Shared/_Tracking.cshtml", Model.Magazine); }

Both the Book and Magazine classes derive from a base class:

 public class PubBase 
   {
        public string PubDate { get; set; }
   }

In the partial view I would like to show:

@model ????
@Html.LabelFor(model => model.PubDate)

I have tried a few different things like casting the Model.Book and Model.Magazine to a a view model that has PubDate but that gives me errors. Is there a way I can implement this. I saw some recent posts about this but I don’t think it applies to my situation. I hope I can get some suggestions.

Thanks,

Richard

  • 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-26T22:41:24+00:00Added an answer on May 26, 2026 at 10:41 pm

    Use PubBase as model for the view

    @model PubBase
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have ViewModel like public class AnotherViewModel { public string Name { get;
I have a strongly typed Person view, that I want to render a partial
in my view I usually do something like this <%= render :partial => shared/p
I want to render a PartialView inside a <iframe src=''></iframe> The rendered partial view
Well I want to render a self closing tag say <img> tag like this
In my Application_Error event handler i want to render an MVC-View for 404. I
In my view, I have a form I want to dynamically render. This form
Is there a way to render inside my view of controller A a partial
I want to designing an application Where i need to generate some partial view
I have the following in a view file: <%= render :partial => medium_deal, :collection

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.