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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:57:45+00:00 2026-05-24T09:57:45+00:00

I Have a View and Partial View. The layout for the view is something

  • 0

I Have a View and Partial View. The layout for the view is something like this:

<html>
...
<div id="MainView">@RenderBody()</div>

<!--Partial View-->
<div id="partialView">@Html.Action("PartialViewForm", "Main")</div>
...
</html>

My Partial View (named as _Register) is something like this:

@model PartialViewModel    
<div id="form">
@using (Html.BeginForm("PartialViewForm", "Main", FormMethod.Post))
{
    @Html.ValidationSummary(true)
    <table  >
        <tbody>
            <tr>
                <td align="left">@Html.LabelFor(model => model.Name)*</td>
                <td>@Html.EditorFor(model => model.Name)</td>
                <td align="left">@Html.ValidationMessageFor(model => model.Name, "")</td>
            </tr>            
            <tr>
                <td align="left"><input type="submit" value="Go" class="submit2"/></td>
            </tr>

        </tbody>
    </table>
}
</div>

In my MainController I have methods like this:

public class MainController  : Controller
{
    public ActionResult Index()
    {
        return View();
    }

    [HttpGet]
    public ActionResult PartialViewForm()
    {
        var partialViewModel= new PartialViewModel();   
        return PartialView("_Register", partialViewModel);
    }

    [HttpPost]
    public ActionResult PartialViewForm(PartialViewModel partialViewModel )
    {
        // if Validation is not successfull 
        return PartialView("_Register", partialViewModel);

       //  else
       ....
    }
 }

This is what I want to do… when validation fails on the partial view I want to g back to the main view… however in my case on the post action when validation fails all I can see is the partialview… there is no main page content.
There are posts on the forum that show the same kind of behavior but I am not able to solve my issue. Can anyone please tell me how to fix it (it will be really helpful if you can modify my example and show it)

Thanks

  • 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-24T09:57:46+00:00Added an answer on May 24, 2026 at 9:57 am

    I’m not sure if I totally understand what you are trying to do but if what I’m thinking is right, you should just use

    [HttpPost]
    public ActionResult PartialViewForm(PartialViewModel partialViewModel )
    {
        // if Validation is not successfull
        model = _db.getBlah(); //get the original model for the main view
        return View("MainView", model);
    
       //  else
       ....
    }
    

    However I think your issue might be that you really should have your form submission in your main view and not in your partial – the partial is just there to render the editors for your Create/Edit views, etc; the data should be submitted to the main view’s action so that it can create/update the proper model.

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

Sidebar

Related Questions

I have something like @{ Html.RenderPartial(@~/Views/Management/_Main.cshtml); } Can I change this view without page
I have ascx partial view with html-layout like that <%=Html.ActionLink<PersonController>(x => x.Publications(param1, param2, ...
in a partial view I have the following: <%Html.RenderAction(MVC.User.GetComments(Model.UserGroupName)); %> can I render a
I have this in my partial view: <tr> <% for (int currentDay = 0;
I have an ASP.NET MVC Partial View that contains a Html.TextBox that is configured
I have an AJAX link that currently loads a partial view into a div.
I have a problem while trying to render a partial action on my layout.
so i have a problem with :partial rendering... I have: index.html.erb view with content
I have a @Html.Action() in my layout, and putting a breakpoint in the controller
I have a partial view which consists of a div with a benner that

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.