I am using Kendo Grid in my MVC application. The Grid has a Command column which contains a custom button for Details that Calls a Javascript function that sends an ajax request to server to get a partial view to replace the #AjaxDiv innerHtml
like below :
function BrandDetailView(e) {
var dataItem = this.dataItem($(e.target).closest("tr"));
var brandID = dataItem.PKBrand;
var xmlhttp;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("AjaxDiv").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open("GET", "/Brand/Details/" + brandID, true);
xmlhttp.send()
}
the Detail partial view contains Kendo DropDownList that generates scripts inside its containing div
. If I send a request to server Like above these scripts wont work, but if I create a Ajax.ActionLink()
like below, they will work.
@Ajax.ActionLink("Detail", "Details", new { id = 2 }, new AjaxOptions()
{
UpdateTargetId="AjaxDiv",
HttpMethod="GET",
InsertionMode=InsertionMode.Replace
})
I am stuck with the Detail button on the Grid, any solutions how to render scripts that way?