如何使用jquery写的table的行hover事件在UpdatePanel中起作用?
我创建了一个用户控件(.ascx文件) , 如下:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="BASMIG.ascx.cs" Inherits="WebApplication1.UserControl.BAS.BASMIG" %><script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script><script type="text/javascript" src="../../Scripts/JSCommon.js"></script><script type="text/javascript"> $(document).ready(function () { formatTable("#tbl"); // 设置table样式及行hover事件 });</script><br /><asp:Repeater ID="repBASMIG" runat="server"> <HeaderTemplate> <table id="tbl" class="separate" cellpadding="3"> <tr> <th> MIG001 </th> <th> MIG002 </th> <th> MIG003 </th> <th> MIG004 </th> <th> MIG005 </th> <th> MIG006 </th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <%# " " + DataBinder.Eval(Container.DataItem,"MIG001") %> </td> <td> <%# " " + DataBinder.Eval(Container.DataItem, "MIG002")%> </td> <td> <%# " " + DataBinder.Eval(Container.DataItem, "MIG003")%> </td> <td> <%# " " + DataBinder.Eval(Container.DataItem, "MIG004")%> </td> <td> <%# " " + DataBinder.Eval(Container.DataItem, "MIG005")%> </td> <td> <%# " " + DataBinder.Eval(Container.DataItem, "MIG006")%> </td> </tr> </ItemTemplate> <FooterTemplate> </table></FooterTemplate></asp:Repeater>
Control ctl = Page.LoadControl(@"~/ChildPage/BAS/BASMIG.ascx"); upContent.ContentTemplateContainer.Controls.Clear(); upContent.ContentTemplateContainer.Controls.Add(ctl); upContent.Update();
$("#tbl").live('mouseenter', function () { .... }).live('mouseleave', function() { ... });