How do I get the control to render text that contains special characters, i.e. those that should be encoded using:
HttpContext
.Current.Server.HtmlEncode("<Test>");
The following code results in a blank item:
DropDownItem testItem = new DropDownItem();
testItem.Text = "<Test">;
webDropDown.Items.Add(testItem);
Thanks.
Hi,
You can use templates for the items:
either <ItemTemplate> or individual templates per item. In the template code in the ASPX markup you can call HtmlEncode
Thank you,
Angel
Thanks, but we have hundreds of WebDropDown descendants that populate themselves by adding DropDownItem objects to the Items collection. Modifying all these controls to use an ItemTemplate defined in the mark up is currently not an option.
Can you suggest another alternative please.