I'm dynamically populating a table with a repeater and I want to trigger an asp:HyperLink when there is a click on a row.
<td id="hyperLink">
<asp:HyperLink ID="lnkDocPage_<%# Eval("ID")%>" ClientIDMode="Static" NavigateUrl="~/Pages/DocumentListPage.aspx?id=<%# Eval("ID")%>" Text="" runat="server">link</asp:HyperLink>
</td>
This is the td with the hyperlink.
And here is the script, that unfortunately does not redirect the user to the DocumentListPage page.
function bindRowClick() {
$('#productTable').find('tr').click(function () {
var id = $(this).find('th:first').text().replace(/\s+/g, " ");
id = ($.trim(id)).split(' ')[1];
var lnkButtonID = '#lnkDocPage_' + id;
alert($(lnkButtonID).attr('href'));
window.location = $(lnkButtonID).attr('href');
});
}
Since each hyperlink has a unique ID depending on the row I firstly calculate the id. I've tried to see if the selector '$(lnkButtonID)' is working - yes it seems that I'm obtaining the hyperlink, but for some reason I can not redirect to the NavigateUrl of the hyperlink.
Any help is appreciated.