Hi,
I am creating an umbraco mvc page that has a template that renders a partial view with 2 dropdown lists and a google map. When i load the page it has the master template with a partial view and it shows everything fine.
When i select an item from the dropdown list i pass the value to the controler and return to the partial view other data. The problem is that the return of the partial view shows only the partial view without the master template.
This is the code in the controller that fires when the page is loaded for the first time and this shows everything:
public ActionResult RenderForm()
{
MapFunction MF = new MapFunction ();
MF=SetDropDown();
MF.JSON= SetMarkers();
return PartialView(Partial_View_Folder + "_MapFunction .cshtml", MF);
}
This is the code that fires when the dropdown is selected:
Also you need to add the folowing script to the master page:
<script type="text/javascript">
$(document).on("change", ".use-ajax1", function (e) {
e.preventDefault();
var form = $(this).closest('form');
$(form).submit();
});</script
MVC partial view renders without master page
Hi, I am creating an umbraco mvc page that has a template that renders a partial view with 2 dropdown lists and a google map. When i load the page it has the master template with a partial view and it shows everything fine.
When i select an item from the dropdown list i pass the value to the controler and return to the partial view other data. The problem is that the return of the partial view shows only the partial view without the master template.
This is the code in the controller that fires when the page is loaded for the first time and this shows everything:
This is the code that fires when the dropdown is selected:
My partial view code with the ddl:
I just want to refresh the partial view without loosing my master page and with new date.
Thank you!
Hi Milos
I want to do something similar... did you find a solution?
I have data coming from a database all working using a partial view. However, if I to display a detail page, I only get the partial view.
Is there a solution for this (AJAX or otherwise)?
Thanks
Muiris
Yes i found the solution.
The problem was the BeginUmbracoForm in the PartialView.
I changed it to:
The problem was the BeginUmbracoForm in the PartialView.
I changed it to:
Also you need to add the folowing script to the master page:
Here is the link to the tutorial that helped me a lot: Submiting with ajax
I was about to give the same answer and link to my post :D
This is exactly what I was after, thank you very much.
I had implemented an accordion show/collapse style list so I could do it all on one page, but this would not be ideal for every solution.
(I find codeshare.co.uk to be a really useful resource).
Thanks again,
Muiris
is working on a reply...