asp.net - Using < > in text for asp:DropDownList option -


i have following in .aspx file:

    <asp:dropdownlist id="title" width="350px" runat="server">         <asp:listitem value="0">please select</asp:listitem>         <asp:listitem value="dr">dr</asp:listitem>         <asp:listitem value="mr">mr</asp:listitem>         <asp:listitem value="ms">ms</asp:listitem>         <asp:listitem value="miss">miss</asp:listitem>         <asp:listitem value="mrs">mrs</asp:listitem>     </asp:dropdownlist> 

i put < > around "please select":

<asp:listitem value="0"><please select></asp:listitem> 

however, file thinks opening new tag when use them.

any ideas on how can use these, possibly escaping them etc.,?

there's text attribute can use text instead of putting text between opening , closing tags:

<asp:listitem value="0" text="<please select>" /> 

you can use html entities if prefer:

<asp:listitem value="0" text="&lt;please select&gt;" /> 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -