c# - Access to hyperlink in listview in Itemtemplate -


I am trying to reach listview at hyperlink . When the user logs in, the hyperlink will show on my homepage. It is not displayed.

  Secure void lvtop6_ItemCommand (Object Sender, ListViewCommandEventArgs E) {ListView hlBuy = (ListView) lvtop6.FindControl ("hlBuy"); If (User.Identity.IsAuthenticated == true) {hlBuy.Visible = true; } And {hlBuy.Visible = false; }}  

Please let me know if my code is wrong behind

It is not clear what you are trying to set visible: your hyperlink or your list view.

You've put a control to type ListView, but your Hungarian signals suggest that it's a hyperlink update your question with more details , and we'll recommend it to Can solve.

Is lvtop6_ItemCommand () ever called? Can you set a breakpoint in that code?

In the meantime, try simplifying your 5 lines of code:

  hlBuy.Visible = User.Identity.IsAuthenticated;  

You may need to enter your hyperlink:

  hyperlink hlBuy = (hyperlink) lvtop6.FindControl ("hlBuy");  

Comments