Home All Groups Group Topic Archive Search About

Help with HtmlTextWriter

Author
7 Jan 2006 2:17 AM
Larry Van
I have been beating my head against a wall for two days now.

I have developed a treeview control that reads in an xml file which
holds the information for building the tree. The nodes are hyperlinks
to other pages. I want to be able to include the inline code
<%Request.QueryString("CID")%>

I use the  htmltextwriter.write method to output the node.

The problem is: When I run the app, the link appears in the page fine
but when I roll over the link the url shows as:
http://mycomputer/xmlnodes/manageforums.aspx?CID=<%=Request.QueryString("CID")%>

Upon further testing, it appears that there is something going on with
the htmltextwriter.write method. I did a simple experiment with the
following piece of code:
htmltextwriter.write(<a
href='manageforums.aspx?CID=<%=Request.QueryString("CID")%>'>my
link</a>")

This produced the same result as above.

If I do " view source" from the browser, which opens notepad the
syntax for the link is correct. Furthermore, I can save that page with
a .aspx extension and load it into the browser and the link works
correctly.

Any ideas? This seems like something developers would want to do quite
often.

Author
7 Jan 2006 5:01 AM
Cyril Gupta
Hello Larry,

Instead of the string literals '<' use &lt; or &#60;

instead of '>' use &#62; or &gt;

Cyril Gupta
Author
8 Jan 2006 1:44 AM
Larry Van
Cyril,

Thanks for replying. I tried that and got the same results. I used:

htmltextwriter.write(<a
href=&apos;'manageforums.aspx?CID=&lt;%=Request.QueryString(&quot;CID&quot;)%&gt;&apos;'>my
link</a>")

any other ideas?

Show quoteHide quote
On Sat, 7 Jan 2006 10:31:13 +0530, "Cyril Gupta" <nom***@mail.com>
wrote:

>Hello Larry,
>
>Instead of the string literals '<' use &lt; or &#60;
>
>instead of '>' use &#62; or &gt;
>
>Cyril Gupta
>