The problem;
I have a view with two partial views one view to handle client side msgs and a gridview.
the gridview is a form and can delete update items. When deleting or updating error/success msgs are generated in tempdata however only the grid partialview is being rendered from the actionresult functions.
I need a way to simply render the messages partial view without posting anything or redirecting it to the controller since the data already exists in tempData.
View:
<div id="page-KnownRecipient">
@Html.Partial("ClientSideMessages")
@Html.Partial("_TabsPartial")
@if(Model != null)
{
using (Html.BeginForm())
{
@Html.Partial("_EditModePartial", Model);//Grid
}
}
</div>
All callback routing from the gridview just returns partialview EditModePartial and since the VIEW is never reloaded the messages that should be displayed in "ClientSideMessages" partial is never rendered after delete/ update callbacks. So accordingly I need a way to render the "ClientSideMessages" partialview using jquery, no new data is needed only the actual rendering of the partialview.
//---- Ended up using something like this;
View;
<div id="detailsDiv">
@Html.Partial("ClientSideMessages")
</div>
Controller;
public ActionResult StatusMessages()
{
return PartialView("ClientSideMessages");
}
JS;
function getStatusMessages() {
var sURL = "/Home/StatusMessages"; // Just put the function in some base controller
var $detailDiv = $('#detailsDiv');
$.get(sURL, function (data) {
$detailDiv.html(data);
});
}
Thanks for tips and pointers tho !