I'm making a dynamic table in ASP . This table has buttons in one of the cells.
I have the following code in page_load
:
StringBuilder htmlStr = new StringBuilder();
htmlStr.Append(
"<asp:button onclick='bttn_pdf_Click' class='btn btn-warning btn-xs' ID='Bttn_PDF'>PDF</asp:button>"
);
PlaceHolder1.Controls.Add(new Literal { Text = htmlStr.ToString() });
This is only the part of the buttons that is where I have problems, the idea is that by clicking on it you download a PDF , but the problem is that when you click it shows the following error in the console :
Uncaught ReferenceError: bttn_pdf_Click is not defined
at HTMLUnknownElement.onclick (VM184 panel.aspx:1)