简体   繁体   English

ASP.net使用Ajax加载部分视图

[英]ASP.net Loading Partial View with Ajax

Actually I was working with the kendo widgets. 实际上,我正在使用kendo小部件。 I have loaded a partial view ' viewport ' inside _Layout to ajax load the other views inside the viewport. 我已经在_Layout内加载了局部视图' viewport ',以ajax加载视口内的其他视图 I have included these scripts inside viewport 我已经将这些脚本包含在视口中

<script src="@Url.Content("~/Scripts/kendo/2013.2.918/jquery.min.js")"></script>

and as per the telerik documentation, 并根据telerik文档

The widget object is undefined after loading a page through AJAX Usually caused when the page loaded via AJAX contains a script reference to jQuery. 通过AJAX加载页面后,未定义窗口小部件对象,通常是通过AJAX加载的页面包含对jQuery的脚本引用时引起的。 When jQuery is re-initialized, all jQuery-based data attributes are cleared, including the data("kendoWidget") attribute that holds the Kendo UI widget object. 重新初始化jQuery时,将清除所有基于jQuery的数据属性,包括保存Kendo UI小部件对象的data(“ kendoWidget”)属性。

I tried to load the script inside the _Layout but it is not working. 我试图将脚本加载到_Layout内,但无法正常工作。 How can it be Solved? 如何解决?

Please Include the script as below . 请包括以下脚本。 But done it on the View page Which is loaded inside of the viewport. 但是可以在加载到视口中的“视图”页面上完成。

Exaple : If you load the XXX page in viewport means. 例如:如果您将XXX页加载到视口中,则意味着。 Then you have to mention the script in XXX page. 然后,您必须在“ XXX”页面中提及该脚本。

While loading the View From AJAX These kind of problem will occurs. 从AJAX加载视图时,会发生此类问题。 Please mention that script only in the XX page with render in Viewport page. 请仅在XX页面中提及该脚本,并在“视口”页面中进行渲染。

<script src="@Url.Content("~/Scripts/kendo/2013.2.918/jquery.min.js")"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM