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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:07:11+00:00 2026-06-14T13:07:11+00:00

I have a controller, action which returns PartialViewResult and view with it. For testing

  • 0

I have a controller, action which returns PartialViewResult and view with it. For testing I output current DateTime (in action), and in view I check if it is null or not, so I know what I got.

When I try to “embed” that view in another one with Html.Action I get current datetime, so my action is called.

But when I use Html.Partial the view is rendered with null, my action method is not called. Besides, two breakpoints and debugger also confirms, in latter case the my action method is not called.

Action method:

public PartialViewResult Test()
{
  return PartialView(DateTime.Now);
}

(partial) View:

@model DateTime?

<p>@(Model ?? DateTime.MinValue)</p>

and call from main view is either @Html.Action("Test") or @Html.Partial("Test").

  • 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-06-14T13:07:12+00:00Added an answer on June 14, 2026 at 1:07 pm

    Html.Action() will call your action method, but Html.Partial() will not. Html.Partial() just renders your partial view, and is useful if you have some static content, or if you’ve already loaded the view data.

    Html.Partial("PartialName", Model.PartialData);
    

    Will render the PartialName view with your model data passed to it. It’s a great way to break up views into clean sections, without having to incur any additional requests to the server.

    Html.Action("Test")
    

    will call your Test action, and render the result.

    This is why you’re seeing the NULL DateTime. Html.Action() is actually calling the action, computing the DateTime, and rendering the view, whereas Html.Partial() is only rendering the view.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a controller index action which returns json output. render :json => my_array.to_json
In my controller i have an action which does not have a corresponding view.
I have an AJAX controller action which returns JSON. The returned JSON is handled
I have controller action which returns JsonResult and is consumed by jquery ajax get
I have a controller action which returns StudentID. [HttpPost()] public ActionResult DisplayStudents() { StudentDataContext
I have a controller action which renders a partial view: public ActionResult Details(int id)
I have a view page with ajax.action link which returns a partial view from
I have controller users . In this controller I have action account which is
I have a javascript function from which I need to call a controller action
I have an url domain.com/a which redirects to domain.com/controller/action/a . How do I get

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.