Reputation: 13744
I am binding to a DropDownList as follows;
Sub bindGalleries(ByVal catID As Integer)
ddlGalleries.DataSource = Galleries.GetGalleries(catID)
ddlGalleries.DataTextField = "GalleryName"
ddlGalleries.DataValueField = "GalleryID"
ddlGalleries.DataBind()
End Sub
One of the items in the list is: 'Kültür & Sanat', which is displayed just right in the dropdownlist. But when I look at the source of the page, it is: Kültür & Sanat
How can I get the source to be exactly the same as the original string?
Note: my meta tag is: in master page..
Upvotes: 3
Views: 8583
Reputation: 1459
The reason why you see those characters is because those characters are being htmlencoded upon saving into your source.
i.e.
YourSource = server.htmlEncode(value)
or
YourSource = server.urlEncode
You can save it to its original form by using server.htmlDecode
or by omitting the server.htmlEncode.
Upvotes: 0
Reputation: 1459
Try to put the proper charset in the heading portion of your page.
Example:
<meta http-equiv="Content-Type" content="text/html; charset=utf-16"/>
Upvotes: 0
Reputation: 15253
This should give you what you need:
Server.HtmlDecode("Kültür & Sanat");
Write a method to "sanitize" the items in the DDL and store them in an array. Then just bind to the array.
You can populate the DDL in a similar fashion.
Upvotes: 3