I have a code-behind function that is called when a hyperlink is clicked. The function should then get the name attribute from the hyperlink and use that string to call another function. The name attribute is being populated by an angular ngRepeat. My problem is that when I try to get the name attribute in the code-behind, it just shows an empty string and not the name attribute that "should" have been passed.
HTML
<a href="javascript:;" data-name="{{invoice.DocumentNumber}}" runat="server" onserverclick="btnPrintInvoiceClicked">Print Invoice</a>
Final HTML Output
<a data-name="90979157" href="javascript:__doPostBack('ctl00$MainContentPlaceholder$ctl00','')">Print Invoice</a>
VB Code-Behind
Public Sub btnPrintInvoiceClicked(ByVal sender As Object, ByVal e As EventArgs)
Dim inv As HtmlAnchor = CType(sender, HtmlAnchor)
Dim invoiceNumber As String = inv.Name
GetInvoicePDF(invoiceNumber)
End Sub
Thanks in advance!
Edit: Added HTML output
data-namedoesn't deliver the right data?<a>tag? As it is written, I'm surprised thebtnPrintInvoiceClickedcallback is being triggered at all (because all server callbacks on webforms happen via form POSTs, not plain a-tag clicks). The only way it could be getting to that function is if .NET then modifies the onclick of the resulting html to do a form submission instead of a url change.