Good afternoon, everyone.
I know this is a pretty simple question from the point of view of MVC, but I canβt get @ Html.RenderPartial for my whole life so as not to give me errors. I use VB.NET and Razor. Most of the examples I found on the Internet are written in C #, which is not difficult for me to convert, but this simple one made me stop. This is in my Index view that _Layout.vbhtml displays:
@Section MixPage @Html.RenderPartial("_MixScreen", ViewData.Model) End Section
The above expression does not give a value.
Today I searched for quite a while, and the pages on which I take examples look like this:
http://geekswithblogs.net/blachniet/archive/2011/08/03/walkthrough-updating-partial-views-with-unobtrusive-ajax-in-mvc-3.aspx
Getting HTML partial view from inside the controller
Ultimately, what I'm trying to do is return and update the model to a partial view from the controller:
Function UpdateFormulation(model As FormulationModel) As ActionResult model.GetCalculation() Return PartialView("_MixScreen", model) End Function
and this controller is called from an expression in javascript:
function UpdateResults() { jQuery.support.cors = true; var theUrl = '/Home/UpdateFormulation/'; var formulation = getFormulation(); $.ajax({ type: "POST", url: theUrl, contentType: "application/json", dataType: "json", data: JSON.stringify(formulation), success: function (result, textStatus) { result = jQuery.parseJSON(result.d); if (result.ErrorMessage == null) { FillMixScreen(result); } else { alert(result.ErrorMessage); } }, error: function (xhr, result) { alert("readyState: " + xhr.readyState + "\nstatus: " + xhr.status); alert("responseText: " + xhr.responseText); } }); }
If there is a better way to bring this updated model back into view and only update this partial view, Iβm all ears. But the premise of these questions is: why does RenderPartial not give value?
jquery asp.net-mvc-3 razor renderpartial vb.net-2010
AaronBastian Jun 15 2018-12-12T00: 00Z
source share