Good day, all.
I know that this is a pretty basic question in terms of MVC, but I can not for the life of me get @Html.RenderPartial to not give me errors. I am using VB.NET, and Razor. Most examples that I have found online are written in c#, which isn't hard for me to convert, but this simple one has got me stumped. This is in my Index view, that is being rendered by the _Layout.vbhtml:
@Section MixPage
@Html.RenderPartial("_MixScreen", ViewData.Model)
End Section
The above expression does not produce a value.
I have looked for quite a while this morning, and the pages that I am taking examples from are as follows:
Getting a Partial View's HTML from inside of the controller
Ultimately, what I am trying to do is return and updated model to a partial view from the controller:
Function UpdateFormulation(model As FormulationModel) As ActionResult
model.GetCalculation()
Return PartialView("_MixScreen", model)
End Function
and that controller is being 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 return this updated model to the view and only update this partial view I am all ears. But the premise of this questions is: Why does RenderPartial not produce a value?