0
我有一个使用AJAX更新的PartialView。使用AJAX更新Div时,HTML元素会正确加载,但Telerik图表未加载。图表中的数据源不调用操作方法:ASP.NET MVC AJAX部分视图Telerik UI未加载
.DataSource(ds => ds.Read(read => read.Action("Movies_Read", "Movies")))
当PartialView最初加载,而不是使用AJAX,数据源被调用动作的方法和图表被正确装入。
根据Telerik ASP.NET PartialView AJAX需要有此Javascript呼吁的onSuccess事件:
<script type="text/javascript">
function updatePlaceholder(context) {
// the HTML output of the partial view
var html = context.get_data();
// the DOM element representing the placeholder
var placeholder = context.get_updateTarget();
// use jQuery to update the placeholder. It will execute any JavaScript statements
$(placeholder).html(html);
// return false to prevent the automatic update of the placeholder
return false;
}
我试图在文件中提到的JavaScript,但GET_DATA()和get_updateTarget()不不存在的事件,虽然我havde添加了MicrosoftAjax.js和MicrosoftMvcAjax.js。我怀疑这些已被弃用。 我也尝试了其他的JavaScript功能,但没有任何运气。
我的AJAX调用是:
@using (Ajax.BeginForm("UpdateMoviesChart", "Movies", new AjaxOptions { UpdateTargetId = "MoviesDiv", InsertionMode = InsertionMode.Replace, OnSuccess = "updatePlaceholder", }))
如何使用AJAX时正确加载Telerik的走势?