JS的Linkbutton动态ID [英] Linkbutton dynamic id with JS

查看:82
本文介绍了JS的Linkbutton动态ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对asp.net的中继器控制内的链接按钮有问题,问题是链接按钮Id生成了类似"repeater_ct001_lnkbtn"的内容,并且我无法在Java脚本中捕获该ID.

感谢您对高级的帮助.

-Abbas

I am in problem with link-button within repeater control of asp.net issue is that link-button Id get generated something like "repeater_ct001_lnkbtn", and i am not able to capture that id in java script.

Thanks for your help in advanced.

-Abbas

推荐答案

我在下面找到了解决方法...

下面是带有中继器的linkBut​​ton
I found solution below...

below is the linkButton with repeater
<repeater>
....
  <asp:linkbutton id="lnkPrd" text="xyz" runat="server" onclick="lnkAw_Click" onclientclick="HrefLnk(this)" xmlns:asp="#unknown"></asp:linkbutton>
......

</repeater>



以下是需要创建的脚本



below are the script which need to create

<script>
function HrefLnk(ctrl) {


(''#''+ctrl.id).live(''click'', function() { eval(
(''#''+ctrl.id).live(''click'', function() { eval(


(''#''+ctrl.id).attr(''href'')); }); } </script>
(''#''+ctrl.id).attr(''href'')); }); } </script>


这篇关于JS的Linkbutton动态ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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