I have a view, on the top there’s a dropdownlist which basically allows user to select one of the two options.On now the basis of this selection i have to show the content on this page.
Now, what ‘d be the right way to go, i should create two partial views and put them in separate divs and on the basis of selection i’d make one of them visible
Or, just have two divs and have my chtml markup inside them and make one of them visible on the basis of user selection.
If you want to use partial views, you could use ajax to load them into a single div containing the content instead of having them both already on the page and hidden.
The jquery call to the controller would look like this:
The controller method would look like this:
Assuming that this is wrapped in a form submitting the name of the partial view you want to return, this would load the html from the partial view into the div with the id
contentDivId.