Cant click links asp.net Listview results, its just normal text
开发者_StackOverflow社区I have a listview with some links for example http://www.google.com. that are outputted to a Asp Label. But the link is just plain text, it isnt clickable, does anyone know how to make all links clickable in each listview? Thanks for any help
Edit:note that the Label does not display only a link, the label displays a paragraph of information and in that paragraph, a link may be in there.
The Label
control isn't a hyperlink. I'd suggest using the HyperLink
control in your ItemTemplate:
HyperLink Class
what i think is your problem lies in using labels to show the links because label do not expose clickable interface instead bind your values in
<a href='<%#Eval("urlfield")%>'><%#Eval("field")%></a>
so that you can click on it and redirect the user, If you wish to get any binded values at server side then use link button and use commanargument and commandname prop's of it.
and yes as our peer tim suggested you can use hyperlink also to make it work
精彩评论