JQueryUI 和 ASP.NET UpdatePanel 之争?有什么快速的替代方案吗?

发布于 2024-09-16 01:21:00 字数 1202 浏览 1 评论 0原文

我使用 asp.net 编程仅几个月,我必须维护一个由许多带有更新面板的 aspx web 表单组成的应用程序。

维护的任务之一是集成一些 JQueryUI 小部件(主要是日期选择器、选项卡和按钮)。

我在顺利执行此操作时遇到一些问题,特别是当控件

  1. 位于更新面板内
  2. 时通常在任何模板化控件内(例如向导控件)

例如这个非常简单的代码:

<script type="text/javascript">

$(document).ready(function() {

 $("#myTabs").tabs();

 $("[ID$=TextBox2]").datepicker();
 $("[ID$=btnOk]").button();

});
</script>

<div>
    Jquery UI controls inside a div (Tabs, datepicker and buttons)
    <br />
    <div id="myTabs">
     <ul>
      <li><a href="#myTabs-1">quick sample</a></li>
     </ul>
     <div id="p-tabs-1">
         <p>In this page there are a datepicker control and a button</p>
         <p>
         Please select a date :<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
         <br />
         <asp:Button ID="btnOk" runat="server" Text="Ok" OnClientClick="btnOk_Click" />
         </p>
     </div>
 </div>
</div>

将立即停止如果放在更新面板中,

是否有解决方案,或者我必须采用完全不同的方法?

非常感谢 ,什么是最好的替代方法?很多 洛伦佐

I have been using asp.net programming just from few months and I have to maintain an application that is made up of many aspx webforms with updatepanels.

One of the task of the maintenance is to integrate some of the JQueryUI widgets (mostly datepicker, tabs and buttons).

I am experiencing some problems on doing this smoothly expecially when the controls are

  1. Inside an update panel
  2. Generally inside any templated control (e.g. Wizard control)

For example this very simple code:

<script type="text/javascript">

$(document).ready(function() {

 $("#myTabs").tabs();

 $("[ID$=TextBox2]").datepicker();
 $("[ID$=btnOk]").button();

});
</script>

<div>
    Jquery UI controls inside a div (Tabs, datepicker and buttons)
    <br />
    <div id="myTabs">
     <ul>
      <li><a href="#myTabs-1">quick sample</a></li>
     </ul>
     <div id="p-tabs-1">
         <p>In this page there are a datepicker control and a button</p>
         <p>
         Please select a date :<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
         <br />
         <asp:Button ID="btnOk" runat="server" Text="Ok" OnClientClick="btnOk_Click" />
         </p>
     </div>
 </div>
</div>

will immediately cease to work if placed inside an update panel.

Do there is a solution regarding this issue or I have to follow a completely differnt approach? Do I have to substitute all the updatepanels? And what is the best alternative to this easy to use control?

Thanks very much
Lorenzo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何其悲哀 2024-09-23 01:21:00

应用 Chuck 建议后,我收到了 javascript 错误(Sys 未定义)。
谷歌搜索把我带到了这个网站 帖子解决了我的问题。
现在一切正常了! :)

After applying Chuck suggestion I was getting a javascript error (Sys is not defined).
Googling around tooked me at this web post that solved my problem.
Now everything works! :)

总攻大人 2024-09-23 01:21:00

请参阅:jQuery $(document).ready 和 UpdatePanels?

updatepanel 会销毁所有 javascript 引用,其中包括 jquery 绑定。如果不这样做,就会造成内存泄漏。

See: jQuery $(document).ready and UpdatePanels?

An updatepanel destroys all javascript references, which includes jquery bindings. If it did not do this it would create a memory leak.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文