简体   繁体   中英

Format option text string

How can I display selected part of an asp.net string with HTML Formatting.

Eg:

String str= "Yerevan Airport(<B>UB21</B>,AM-ER,Yerevan,)";

I need to display the text enclosed in <B> and </B> in bold and display it as text in RADComboBox .

I have tried it with using StringBuilder , HttpUtility.Htmlencode, String.Format but couldn't find any proper solution.

What you are trying to achieve is not possible.

The DropDownList control of ASP.Net renders to a html <select> control which doesn't allow markup inside it's <option> elements.

Try this:

  String str = "Yerevan Airport &lt;BR /&gt; UB21 &lt;BR /&gt;";
  String strHtml = Server.HtmlDecode(str);

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