MyDropDown = System.Web.UI.WebControls.DropDownList
MyReader = System.Web.UI.WebControls.SqlDataReader
MyDropDown.Items.Add(New ListItem(MyReader("Value1"), MyReader("Value2")))
I have a dropdownlist that I want to add values to. The problem is that
the values in question have HTML in them. So in this example MyReader("Value1")
will have values like a and then b etc
Instead of getting a dropdownlist as follows
<select>
<option value="a"> a</option>
<option value="b"> b</option>
</select>
I end up getting
<select>
<option value="a">&nbsp;a</option>
<option value="b">&nbsp;&nbsp;b</option>
</select>
as it html encodes the '&' on the fly which will renders
my nbsp null and void.
How do you prevent this HTML encoding going on?
MyReader = System.Web.UI.WebControls.SqlDataReader
MyDropDown.Items.Add(New ListItem(MyReader("Value1"), MyReader("Value2")))
I have a dropdownlist that I want to add values to. The problem is that
the values in question have HTML in them. So in this example MyReader("Value1")
will have values like a and then b etc
Instead of getting a dropdownlist as follows
<select>
<option value="a"> a</option>
<option value="b"> b</option>
</select>
I end up getting
<select>
<option value="a">&nbsp;a</option>
<option value="b">&nbsp;&nbsp;b</option>
</select>
as it html encodes the '&' on the fly which will renders
my nbsp null and void.
How do you prevent this HTML encoding going on?