Solved

building asp.net tag string for output

Posted on 2002-05-16
4
236 Views
Last Modified: 2013-11-19
inside a codebehind file i build a string containing the <asp:xml> tag... with attributes inside etc.

then output that string in .aspx page as <%=strASPTag%>

the problem is that it is not resolving the tag... it just prints it out as plain text!

the string is being set like this in the codebehind:

strASPTag = "<ASP:XML ID='XMLContent' DOCUMENTSOURCE='../Foo.xml' TRANSFORMSOURCE='../Foo.xslt' RUNAT='server' />";

should i be using double-quotes instead of singles? if so, do i need to use some escape character?

thanks...
0
Comment
Question by:loyaliser
  • 2
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 50 total points
ID: 7015323
Your string is alright, only problem is that ASP.Net is not prcessing your asp:xml server control. It emits the string as is.  All the server side control processing takes place at page load time. By the time you are trying to add asp:xml control using your technique, it is not processing the string as a server side control. It emits the string as any HTML tag.
If you want to add a asp:xml control at some location, use asp:PlaceHolder contro.. And then in your code behind, you can add asp:xml control to this place holder programtically.
0
 
LVL 1

Author Comment

by:loyaliser
ID: 7015426
that solves the problem... thank you!
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 7015543
I am glad that helped.
May be you wanna close this question and move it to PAQ.

Naveen
0
 
LVL 1

Author Comment

by:loyaliser
ID: 7016419
oops... forgot to close.

thanks again!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question