Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

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).attr('href'));
      });
   }
</script>
 
Share this answer
 
hi, get the id of the Link button like this:

var linkButton= '<%= LinkButton1.ClientID %>';

alert(linkButton);

hope this will help you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900