How is it possible to reference an element that is added to the html during pageload?
In my example I am trying to click a butten with the id of Clicker during page load.
However, because it is added to the html during page load, i get context error.
Error: Compiler Error Message: CS0103: The name 'clicker' does not exist in the current context
protected void Page_Load(object sender, EventArgs e)
{
//add button to html
locationsTable.InnerHtml = htmlString;
//click the button
clicker.PerformClick();
}
htmlString += "<td><button id=\"clicker\" runat=\"server\" class=\"btn btn-default btn-xs\" onclick=\"return false;\"><span class=\"glyphicon glyphicon-option-horizontal\"></span></button>" + " " + "<a href=\"ModifyOrder.aspx?cid=" + row["CustomerID"] + "\" class=\"btn btn-primary btn-xs\">Add License</a></td>";
This htmlString is added to an html table (along with other elements, but they are irrelevant) during page load.
locationsTable.InnerHtml = htmlString;