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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:17:50+00:00 2026-06-11T23:17:50+00:00

I have a form with some controls. There is a button on the form

  • 0

I have a form with some controls. There is a button on the form which loads a partial view. Inside the partial view, there are two required field textboxes along with a button. And when its clicked, I need to display error messages only for textboxes which are inside the partial view, but not for the fields in the actual form. And when I click form’s submit button, all error messages must show up.

After partial view is loaded, I am re-initializing the validation plugin as below.

$('#test').removeData("validator");
$.validator.unobtrusive.parse('#test');

I tried using validation attribute described in below thread but its not working. Maybe it works for normally loaded views.

ASP.NET MVC Validation Groups?

However, I can validate individually by calling textbox1.valid() and textbox2.valid(). But I think I am missing standard way of doing it. Any help is appreciated.

  • 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-11T23:17:51+00:00Added an answer on June 11, 2026 at 11:17 pm

    you can do this by submitting your partial view using Ajax.BeginForm()

    //In Partail View
    @model SomeModel
    

    @using (Ajax.BeginForm(“SomeActionName”, new AjaxOptions { HttpMethod = “POST”, UpdateTargetId = “targetId”}))
    {

               @Html.EditorFor(mode=>model.FirstText)
               @Html.EditorFor(mode=>model.SecText)
               <input type="submit" value="save">
     }
    
    //In Controller
    
    public ActionResult SomeAction(SomeModel model)
    {
        return PartaiulView(model);
    }
    

    here you can validate your Partial View
    NOTE: when you submit you form using Ajax.BeginForm you must specify “UpdateTargetId” where your result will be appear on View.

    //In View
    
    <div id="targetId">
       @Html.Partail("PartialView")
    </div>
    

    OR if you want to Redirect to another action if your model is valid then modified your action

    public ActionResult SomeAction(SomeModel model)
        {
            if(ModelState.IsValid)
            {
                return Json(new {redirect = @Url.Action("SomeAction","SomeController")})
            }
            return PartaiulView(model);
        }
    

    then in partail view you can invoke OnSuccess method of Ajax.BeginForm

         @using (Ajax.BeginForm("SomeActionName", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "targetId",OnSuccess="success"}))
             {
    
             }
    
    <script type="text/javascript">
    
      function success(data)
      {
            if(data.redirect)
            {
                windows.location = data;
            }
      }
    </script>
    

    check both way which one is suitable to you.

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

Sidebar

Related Questions

I have a Form on which there are two controls, a Button and a
I have an MVC page, with some controls inside a form. The part I
On my form I have a IWTreeView and two buttons. One button deletes some
I have a form in my asp.net mvc(C#) application which handles some dynamic controls.
I have a form with some controls. (Actually, this is a sort of ongoing
I have a form and a sub-form, both with some controls that are bound
I have an asp.net form that contains some html, 2 controls a calendar from
I have a page with user controls getting dynamically added. Inside some of these
i currently have a form which i dynamically created a 2D array of textboxes,
I have a form full of controls, and there is no room for other

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.