i am binding my repeater with database values and with anchor tags as below
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<a href='#Roles' id='<%# DataBinder.Eval(Container.DataItem,"RoleID") %>'>
<%# DataBinder.Eval(Container.DataItem,"RoleName") %></a>
</ItemTemplate>
</asp:Repeater>
the output of above will be like this
abcd--anchor tag with id=1
efgh--anchor tag with id=2
ijkl--anchor tag with id=3
on click of the above anchor tag i want to fill the gridview.
if i detect the anchor click with id it should be something like below,
but i don’t understand how to achieve it through single function
$(document).ready(function() {
$('#1').click(function(e) {
e.preventDefault();
Logout();
});
});
any hint how to do this?
First, add a class to the anchor tags, something like
logoutlink. Then use jQuery’slive()function instead of theclick()function:This will attach the event handler to any dynamically created anchor tags that have the
class="logoutlink"attribute.