Setting HiddenField .Value

  • Thread starter Thread starter Efi Merdler
  • Start date Start date
E

Efi Merdler

Hi,
In my code I'm doing some xml transformation, at the end I receive a
fully transformed html file.
I'm setting the Value property of an hidden field control to have the
content of this html file.

In the debugger I can see that the control contains the value
correctly, however when the page is displayed in a browser all <
symbols are replaced by &lt; .

How can I change this behavior.
Thanks,
Efi
 
You don't. Technically, this is very correct as < is only valid for HTML
elements. If it's anything else, it needs to be an &lt and that goes for
text as well as form field values. What you should do is run the
Server.HtmlDecode on the value of the hidden field value when you're
accessing it.
 
You can't. The '<' and '>' characters are not legal values in a form field,
or anywhere else in an HTML document except as element brackets. That is why
they are HtmlEncoded when you put the string into the Hidden form field.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
Kevin Spencer כתב:
You can't. The '<' and '>' characters are not legal values in a form field,
or anywhere else in an HTML document except as element brackets. That is why
they are HtmlEncoded when you put the string into the Hidden form field.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

Thanks to both of you,
The Xml control does manage to output my xml as correct html, so why
it can and I can't (I sound like a little boy :-) )
 
Thanks.
Maybe you can help me solve my problem, in order to decrease the
number of times a user has to fetch data from the server, I'm saving
data in an hidden field, so when the user decides to display the new
data I'm using javascript to display it.

Do you have another idea how can I implement such a behavior ?

Thank you,
Efi
 
Back
Top