Last post Jul 26, 2007 07:24 PM by RoundSparrow
Dec 27, 2006 07:48 AM|Zebedee0024|LINK
i have a bit of a issue,. i setup my classifeds website, but i used "&" in a categories, they look all right on the default page but you drill in the the category "&" appears,
Any ideas on fixing this?
you can look at my web site http://www.jerseyadvertiser.co.uk/
Dec 27, 2006 10:35 AM|mattbug|LINK
The Admin/Categories.aspx page's AddCategoryButton_Click event HTML-encodes the category name string, which (among other things) causes your ampersand to become "&":
A quick and dirty way to fix this would be simply to go into the Categories table and change all the instances of "&" to "&".
I haven't figured out a good permanent fix for this yet...
Dec 27, 2006 10:53 AM|mattbug|LINK
One way to fix this would be to replace "&" with "&" immediately after HTML-encoding the text. Here's how I accomplished that:
First, add a new function to App_Code/Web/OutputFormatting.vb:
I'm not sure if this is the best way to fix this issue since it only addresses ampersands and not other items that may be displayed incorrectly, but it gets the job done.
Dec 27, 2006 10:57 AM|mattbug|LINK
Dec 27, 2006 01:07 PM|Zebedee0024|LINK
i know this might sound stupid but i throught the this infomation is stored in the database and not the HTML code! but then say that the HTML reads the data from the database to display it, so it sounds like a HTML code issue, i have only just started out
doing programming and not sure what to change!!!
Dec 27, 2006 03:19 PM|mattbug|LINK
In the spirit of keeping it simple, for each category that you have created, just change the ampersand back to "&" in the database.
Dec 27, 2006 04:15 PM|Zebedee0024|LINK
Jul 26, 2007 02:13 PM|RoundSparrow|LINK
I too think changing it in the database is not really appropriate. Basically the problem is that in listboxes and such it needs to be properly URLDecoded.
Anyone have code changes to share?
Jul 26, 2007 07:24 PM|RoundSparrow|LINK
We discovered that the 'proper fix' is to change htmldecode value on many of the output controls (but not all).
The most interesting observation: If you enter a new category in /Admin/ it _is_ HTMLEncoded before insertion into the database. However, the "sample pre-defined categories" that come with the download of the application... are NOT HTMLEncoded. So the
data that comes in the binary database masks the problem ;)