Click here to Skip to main content
15,071,637 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have one transaction detail screen where user will select what type of transaction he wants to perform. Financial or non financial. In financial transaction there are sub types like cash withdrawal, check withdrawal and so on. When user enters all the details and clicked on validate transaction button, certain rules are run in the backend in the form of store procedure to determine what type of validation needs to perform based upon transaction type selected by the user and that validation type's view is getting populated on next screen. Validation type may be call customer care, ask for signature verification and so on.  Now on this page there a one dropdown list which contains all the validation type. So what I want to do is, when user select any validation type from dropdown list, view for that particular validation type is needs to display. How to display that particular view based upon dropdown selection change event. I also need go fill the model at same drop down change event.

What I have tried:

I have written a jquery code on drop down change event, but stuck how to display a partial view using jquery. Also it's showing model null while displaying a view. I am not able to fill the model at the change event of drop down.
Posted
Updated 14-Aug-18 7:56am
Comments
F-ES Sitecore 10-Aug-18 4:29am
   
I just googled "display partial view jquery" and got 413,000 results. I suggest you start with at least the top 5 results and try their suggestions. If you're still stuck then post the code you have and explain what it is doing that it shouldn't and not doing that it should.

Quote:
but stuck how to display a partial view using jquery.

Here's one way to do it:

First, define a div element.

HTML
<div id="divContainer"></div>


The div will serve as the container for your PartialView.

Now, in your jQuery code, you can load your PartialView to that container like this:

JavaScript
$("#divContainer").load("@(Url.Action("YourPartialViewActionName","YourControllerName", new { id = TheIDParameterValueThatYouWantToPassInYourAction  }))");


Alternatively, you can use the jQuery .html() function to load your PartialView just like what is demonstrated here: https://www.c-sharpcorner.com/UploadFile/d551d3/how-to-load-partial-views-in-Asp-Net-mvc-using-jquery-ajax/
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900