Help with HtmlTextWriter

  • Thread starter Thread starter Larry Van
  • Start date Start date
L

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.
 
Hello Larry,

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

instead of '>' use > or &gt;

Cyril Gupta
 
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?
 

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

Back
Top