【发布时间】:2010-10-01 10:39:38
【问题描述】:
我正在尝试做一些应该相对简单的事情。我正在使用 ListView 显示许多项目,使用 ItemTemplate。在 ItemTemplate 内,我有一个围绕整个项目的 div,以便我可以突出显示悬停事件(已由 jQuery 处理)。
我想做的是让 div 上的 click 事件触发一个按钮以打开该特定项目的详细信息视图。我遇到的问题是在使用 jQuery 时拉回该按钮的 ClientID。我试过了:
$('#<%= Button1.ClientID %>')
路由,但这不起作用,因为页面加载时按钮不存在。
基本代码如下:
<asp:listview>
<itemtemplate>
<td runat="server">
<div class="container">
<asp:linkbutton id="Button1" runat="server" text="View Details" />
fun and exciting stuff here...
</div>
</td>
</itemtemplate>
</asp:listview>
非常感谢任何建议或帮助!
【问题讨论】: