Hi Rick
We have analyzed the issue that you have mentioned. For your
convenience, we have created a simple sample with partial view to repopulate
the data within the div using the ajax call. The sample can be downloaded from
the attachment. Please refer the below code snippet:
[In
index.cshtml] <div id="main"> @Html.EJ().Button("click").Text("Render
Grid").Render() @Html.Partial("_partial", this.ViewData)
</div> <script type="text/javascript">
$("#click").click(function () { $.ajax
({
url: "Home/Productpartial",
type: 'GET',
success: function
(data)
{
$("#main").html(data);
}
});
}); </script> [In
controller]
public
ActionResult Productpartial()
{
var
DataSource = new NorthwindDataContext().EmployeeViews.ToList();
ViewData["datasource"] = DataSource;
return PartialView("_partial",ViewData);
} |
We suggest you to use return PartialView("_partial",ViewData) instead of return View("_partial",ViewData), because the whole html page is bound to the
data of the success event of ajax call and the scripts tags are again included
within the partial page content. Hence this issue had arosed.
Note: While rendering a control in the partial view,
we need to specify @Html.EJ().ScriptManager()
in the partial view page after the initializing the control. Please refer the
below code snippet.
[In _partial.cshtml] @(Html.EJ().Grid< object >("Grid") .Datasource((IEnumerable<object>)ViewData["datasource"]) .AllowSorting()
.AllowPaging() .Render()) @Html.EJ().ScriptManager() |
Please let us know if you need any further assistance.
Regards
Ragavee U S
Hi Rick
Thanks for the update.
We are happy that your issue is resolved.
If you have
any issues in the future, please get back to us. We will be happy to
assist you.
Please let us
know if you would require any further assistance.
Regards
Ragavee U S