Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display some result based on the content that is clicked. but i'm not sure how to get the server side click event of the content since it is created dynamically. The contents are in anchor tags and based on which one is clicked, i would want to perform a different operation. Below is my code thanks for the help
VB
For i As Integer = 0 To MyDataset.Tables("Ds").Rows.Count - 1
    With MyDataset.Tables("Ds").Rows(i)
        results.InnerHtml = results.InnerHtml & "<div class='nice_css'><a href='#'  runat="server" id='go" & i & "'>" & .Item("Title") & "<br />" & .Item("Description") & "</a></div>"
    End With
Next i
Posted
Updated 17-May-15 20:59pm
v2
Comments
ZurdoDev 18-May-15 9:51am    
You can't add runat="server" dynamically to get dynamic controls. It won't get executed.

I'm not sure what you want exactly but you create controls by doing something like:
HtmlControl temp = new HtmlControl();
temp.InnterHtml = "sdfsdfds..."
Page.Controls.Add(temp);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900