I am going to have a listview with links that get binded from the database. I am wanting to track when that link gets clicked on. This will be so i can tell what links are clicked on the most. I tried doing this with a linkbutton, but ran into the problem where the color does not change when it is visited. I doubt i can do it with a hyperlink since the hyperlink does not hit the server. Any suggestions on how to do this.
This is how i did the linkbuttons
<asp:ListView ID="lstvTopTen" runat="server">
<ItemTemplate>
<tr>
<td width="100%">
<asp:LinkButton ID="lbtnUrlLink" runat="server" Text='<%# Bind("NewsTitle") %>'
CommandArgument='<%# Bind("NewsUrl") %>' onclick="lbtnUrlLink_Click"
OnDataBinding="lbtnUrlLink_DataBinding" CssClass="newslink" />
<asp:Label ID="Label1" runat="server" Text='<%# Bind("NewsDescriptionDisplay") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
here is my css
.newslink
{
display:block;
margin: 15px 0 0 0;
text-decoration: none;
font-size:1.2em;
line-height: 1.8em;
border-bottom:1px solid #CCC;
}
.newslink:visited
{
color: Red;
}
So this is how i ended up doing it.