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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:56:02+00:00 2026-05-28T15:56:02+00:00

In my view, I have a form I want to dynamically render. This form

  • 0

In my view, I have a form I want to dynamically render. This form is wrapped around a larger form:

<form>
    //......stuff...

    @using (Ajax.BeginForm("FindWorkOrder", new AjaxOptions { 
        UpdateTargetId = "workOrders" }))
    {
        <input type="text" name="workOrder" />
        <input type="submit" value="Find" />
    }

    <div id="workOrders">
        @{ Html.RenderPartial("DisplayWorkOrder"); }
    </div>
</form>

In my controller:

public ActionResult FindWorkOrder() 
{
    // do query, return a model
    return View();
}

I have a partial view named DisplayWorkOrder.cshtml.

Several questions:

  • How can I render this partial view with the data I receive from the FindWorkOrder controller?
  • When I press the submit button in the ajax form, the whole form submits. How can I only limit it to that specific area?

My intended functionality is for the ajax form to submit (without the whole form submitting) and populate <div id="workOrders"> with data that I queried.

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-28T15:56:03+00:00Added an answer on May 28, 2026 at 3:56 pm

    1

    To render the partial view , you can do this

    @Html.RenderPartial("DisplayWorkOrder")
    

    If you want to pass a model to the Partial view,you can do this

    @Html.RenderPartial("DisplayWorkOrder",Model)
    

    If you want to pass a proprty of the model to the Partial view,you can do this

    @Html.RenderPartial("DisplayWorkOrder",Model.MyProperty)
    

    Assiming that you have a model binded to the initial (parent) view from where you want to call the partial view. You should be returning the Model /View Model in your Action called “FindWorkOrder” .Something like this

    public ActionResult FindWorkOrder() 
    {
       CustomerViewModel objCustVM=CustomerService.GetCustomerViewModel();  // just to get the customer model.
        return View(objCustVM);
    }
    

    and in your Main View

    @model MyProject.ViewModel.CustomerViewModel    
    <h2>This will show the content from Partial View</h2>
    @{    @Html.RenderPartial("DisplayWorkOrder",Model)}
    

    2

    To Avoid submitting the enitire form, you could do a jquery ajax call from your script with the data you want to send. I would keep the (only one) form tag at the outer level and change the submit button to normal button control.

    $("#submitWorkOrder").click(function(){
    
     //Do validation
    
      var id=233; //get customer id from wherever you have it
      ajaxUrl="Customer/SaveWorkOrder/"+id+"?workOrderId=$("#workOrder").val();
      $.ajax({
              url: ajaxUrl,  
              success: function(data){
                    //do whatever with the result data.
                                     }
             });    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form in my view: <!-- Bug (extra 'i') right here-----------v -->
I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
this time it's about Ruby On Rails. I have a form in the view
I have a view user control that can post form. This control can be
I have a form MyForm which I update using ajax as the user fills
I have several forms each having a hidden field that identifies this form...I want
In MVC Application, I want to render some parts of form dynamically (which are
Using MVC3, C#, and the Razor View Engine: I have a form that has
I have form area in my view. If I click button A , I
I have a form in witch users can add their working hours view them

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.