& problem with hyperlink control

F

FoundThisOnline

I have been searching online for a whole day and couldn't find an
answer for this. I have this hyperlink server control:

------------------------------------------------
<asp:HyperLink ID="hylForms" Runat="server"
NavigateUrl="#">Forms</asp:HyperLink>

Codebehind:

protected HyperLink hylForms;

hylForms.NavigateUrl = "?Dept=" + Request.QueryString["Dept"] +
"&Sect=forms";
------------------------------------------------

Very straight forward right? I think so too but when it renders the
HTML the "&Sect" part turned into "&amp;Sect" and the whole link would
be

?Dept=HR&amp;Sect=forms


Thinks I have tried already:

- Delete the dll and recomplie
- Different server
- Move all the code on the asp.net page and no codebehind
- Try different HTML characters (eg "<") that supposingly will render
as well but only "&" will turn into "&amp;"


Could someone give me a clue?

Thanks in advance.
 
F

FoundThisOnline

It's amazing how I found the solution now but not the entire day
yesterday!

Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");

That will just take care of the problem!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top