Link to home
Start Free TrialLog in
Avatar of michelle0
michelle0

asked on

ASP.NET VB.NET and using a code block for CDATA in XML

I want to use a code block <%= %> to specify a string in a CDATA node of an xml doc.  I am using VB.NET, so I am writing the XML directly in the response (VS2008).

The first example WORKS.  The 2nd example DOES NOT.  The difference is that I am using a code block to get the Product code for my url in the CDATA text node.

Ideas?  I prefer NOT to create the XML doc itself as I have a whole lot of these to develop and prefer to use the slick VB.NET xml editing feature for the Write method.

TIA,
Ken
Response.Write(<description><![CDATA[<img align='left' src='https://www.server1.com/ImageHandler.ashx?code=192932'/>]]><%= Left(x.ProductDesc, 180) %>...</description>)
 
 
Response.Write(<description><![CDATA[<img align='left' src='https://www.server1.com/ImageHandler.ashx?code=<%= x.ProductCode %>'/>]]><%= Left(x.ProductDesc, 180) %>...</description>)

Open in new window

Avatar of Jeff Certain
Jeff Certain
Flag of United States of America image

Perhaps try
src=<%= "https://www.server1.com/ImageHandler.ashx?code=" & x.ProductCode %>
ASKER CERTIFIED SOLUTION
Avatar of michelle0
michelle0

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial