I have a data bound repeater on my ASP.NET page. I am using the repeater to build a list of elements, each one consisting of a text (given by a column in the data bound table) that may be hyperlinked to another page. Whether or not a hyperlink should be included is determined by another column in the data bound table.
I am not sure how to approach the problem. Should I use an HyperLink server control that is shown or hidden depending on the value in the second column? How can I then change the Visible property of this control for each item in the repeater? Are there better approaches?
Thanks.
You can have two controls. One being a hyperlink and one being a regular label or literal. Then, in the ItemDataBound event, show / hide the appropriate controls based on the value of that second column. See the example code below. You will obviously need to change it to fit your situation.