title: ASP.NET: How do I handle a click event from a <a> element within a literal.text?
body: <p>I'm creating <code>&lt;div&gt;</code>'s and appending them to a literal's text property. I have added a <code>&lt;a&gt;</code> element to the text so that the user can click on a specific element.  How can I tie that to a function to handle the event in the codebehind (vb.net) ? </p>
  
  <p>Example of my Literal.Text ...</p>
  
  <pre><code>    For Each row As DataRow In oDataTable.Rows
         MyLiteral.Text &amp;= "&lt;div style='font-size: 8.25px; text-transform:uppercase; padding:3px; background: #FF8C00; border: 1px solid #000; margin: 0 5px 0 5px; display:inline-block; float: left;'&gt;" _
                           &amp; row.Item("LastName") &amp; " | &lt;a href='#?"&amp; row.Item("ID") &amp; "' style='color: #000;' &gt;X&lt;/a&gt;&lt;/div&gt;"
      Next
  </code></pre>
  
  <p>So the above code I want to somehow allow the user to click the X link and then it would remove that person.</p>
  
  <p>Edit: If there is a better way of doing this, that would be great to hear also! Thanks.</p>