How do I loop through items in asp:DropDownList and remove HTML tags?

SweetCheeks

New member
I have a dropdownlist on my page, but the text it pulls from the database has HTML tags in it, like <br />, etc. I am trying to remove those so they don't show up in the list, but I can't get it to work.

This is what I have so far:

public void ddlEditPM_OnPreRender(object sender, System.EventArgs e)
{
for (int i = 0; i <= ddlEditPM.Items.Count - 1; i++)
{
ddlEditPM.DataTextFormatString.Replace(" < ( . | \ n ) * ?>", " ");
}
}

Any help is great! Thanks! ^^
 
Back
Top