jQuery的集成到现有的ASP.NET Web应用程序? [英] Integrating jQuery into an existing ASP.NET Web Application?

查看:101
本文介绍了jQuery的集成到现有的ASP.NET Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近的公布的JavaScript / HTML DOM库 jQuery将被集成到ASP.NET MVC框架,并于ASP.NET / Visual Studio中。

Microsoft recently announced that the Javascript/HTML DOM library jQuery will be integrated into the ASP.NET MVC framework and into ASP.NET / Visual Studio.

什么是使用的的最佳做法或采取的策略jQuery的ASP.NET 2.0 ?我想prepare大,现有的ASP.NET Web应用程序(不可以 MVC)的jQuery。我将如何处理版本及相关问题的?

What is the best practice or strategy adopting jQuery using ASP.NET 2.0? I'd like to prepare a large, existing ASP.NET Web Application (not MVC) for jQuery. How would I deal with versioning and related issues?

是整合jQuery和任何警告的 ASP.NET AJAX ?或第三方组件 Telerik的一样或Intersoft控件?

Are the any caveats integrating jQuery and ASP.NET Ajax? Or 3rd party components like Telerik or Intersoft controls?

推荐答案

对于我来说,使用的UpdatePanel和jQuery的时候(与MVC没有问题,它没有一个页面生命周期,是真正无状态)出现问题。例如,有用的jQuery成语

For me, problems arise when using UpdatePanels and jQuery (no problem with MVC, which doesn't have a Page Life-Cycle and is truly stateless). For instance, the useful jQuery idiom


$(function() {
  // some actions
});

用来增强你的DOM或附加事件到DOM元素是否有在页面中的UpdatePanel可能无法与ASP.NET回发模型交互非常好。到现在为止,我用下面的code段绕过它

used to enhance your DOM or attach events to the DOM elements may not interact very well with the ASP.NET PostBack model if there are UpdatePanels in the page. By now, I circumvent it with the following code snippet


if (Sys.WebForms.PageRequestManager) {
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function() {
    $('#updateListView1').trigger("gridLoaded");
  });
}


其中, gridLoaded 将替换 $(文件)。就绪

我认为你必须采取额外的照顾和非常清楚的ASP.NET页/控制,以混合两种技术的生命周期。

I think you have to take extra care and know very well the ASP.NET Page/Controls Life-Cycle in order to mix both technologies.

这篇关于jQuery的集成到现有的ASP.NET Web应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆