By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,282 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

preprocessing ASP.NET tags generated by the XML Control

P: n/a
Hi, I have an ASP.NET webpage that contains an ASP.NET XML control.
This control accepts an XSLT stylesheet and XML document which it then
uses to render HTML code where the XML control is positioned for the
client at the server.

This setup works great for an XSLT stylesheet that generates plain HTML
tags. But, this doesn't work so well if I use ASP.NET tags (such as
<asp:dropdownlist>) inside the stylesheet. Although the code for the
ASP.NET tags DOES get generated by the XML control, it doesn't get
processed by the ASP.NET engine which converts such tags into regular
HTML tags.

As a result, if you view the resulting code on a browser, you will see
that all the <asp:xxxxtags generated by the stylesheet have been sent
to the browser as is.

Is there anyway to force the output of an XSLT transformation to be
pre-processed by ASP.NET before the page is returned to the browser?

Andy

Nov 1 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Andy wrote:
Hi, I have an ASP.NET webpage that contains an ASP.NET XML control.
This control accepts an XSLT stylesheet and XML document which it then
uses to render HTML code where the XML control is positioned for the
client at the server.

This setup works great for an XSLT stylesheet that generates plain HTML
tags. But, this doesn't work so well if I use ASP.NET tags (such as
<asp:dropdownlist>) inside the stylesheet. Although the code for the
ASP.NET tags DOES get generated by the XML control, it doesn't get
processed by the ASP.NET engine which converts such tags into regular
HTML tags.

As a result, if you view the resulting code on a browser, you will see
that all the <asp:xxxxtags generated by the stylesheet have been sent
to the browser as is.

Is there anyway to force the output of an XSLT transformation to be
pre-processed by ASP.NET before the page is returned to the browser?
You can't use XML control here. You have to transform XML into HTML in
code using XslCompiledTransform class and then make your page to parse
generated HTML to process server controls. See a sample at
http://www.devx.com/tips/Tip/27128

--
Oleg Tkachenko [XML MVP, MCPD]
http://blog.tkachenko.com | http://www.XmlLab.Net | http://www.XLinq.Net
Nov 2 '06 #2

P: n/a

Thanks Oleg, that's what I was looking for!

For others reading this post, what Oleg referred to is:

The XML Control automatically renders the HTML from the XSL
transformation into your webpage without parsing the resulting HTML
code for ASP.NET controls.

You could parse the resulting HTML code yourself and insert the parsed
code into a placeholder on your ASP.NET page instead:

where aspPlaceHolder is an ASP.NET place holder on your page, and
aspHTML is the outputed ASP.NET HTML code segment from an XSL
transformation,

aspPlaceHolder.Controls.Clear()
aspPlaceHolder.Controls.Add(Page.ParseControl(aspH TML))

Nov 2 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.