简体   繁体   中英

Hyperlinks in TextBox/ListBox ASP.NET

I have read some posts online that say you can not include Hyperlinks in Textbox or listboxes in html. I am reading text from a DB and part of that text are hyperlinks to articles. What control should I use therefore to display text in a scroll-able control and be able to include hyperlinks that will lead to other sites on the web?

  1. You can use a DropDownList or a ListBox and store the hyperlink as the value, and add a javascript change event that will redirect them to the value (hyperlink) of the selected item... or do it on postback.

  2. You can use a Repeater and use regular hyperlinks. If you want it "scroll-able", put it in a container of fixed height with an overflow:scroll;

  3. You can use a DataGrid if you have many items that aren't a good fit from dropdown, etc.

It really depends... you'll need to try something and if you have problems with code, come back and ask a question that can be answered with code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM