I have the following code:
Dim db As New linqclassesDataContext
Dim categories = (From c In db.faq_cats)
NewFaqDropDownCategory.DataSource = categories
NewFaqDropDownCategory.DataTextField = "category"
NewFaqDropDownCategory.DataValueField = "category_id"
If Not Page.IsPostBack Then
NewFaqDropDownCategory.DataBind()
End If
Unset(categories)
Unset(db)
One of the items under the column "category" has &
in the title, and that shows up in the dropdownlist as such. Is there someway to make the list display "&" instead?
One Solution
I figured I could use the .Replace() function to do this, and I accidentally found out how:
For Each c In categories
If c.category.Contains("&") Then
c.category = c.category.Replace("&", "&")
End If
Next
I could expand this in the future to process other values as well.