generating ASPX with XSL

  • Thread starter Thread starter Andy Fish
  • Start date Start date
A

Andy Fish

Hi,

In my aspx web application, I am generating a list of items in a menu down
the left-hand side. Different items in the list may have different controls
in, and this is data-driven at runtime.

At the moment I am using a custom template control similar to a repeater but
with many different templates. However, It's a bit of a pain to work with
and maintain. What I would like to do is generate the list of menu items
using XSLT

Of course I could generate the page output with XSLT but then I would only
be able to generate pure HTML in it, not asp.net controls, so I wouldn't be
able to use postbacks.

What I'd really like is to have an XSLT equivilent of data binding whereby
the datadinder is replaced by an XSLT processor which generates a tree of
aspx controls which then get put into the page. then I can still manipulate
them programmatically.

I guess there is probably some solution which involves me writing an aspx
page as text and then compiling it to make a class, but I definitely can't
afford to have the overhead of compiling each time the page is loaded.

Anyone else thought of this or come up with a good solution to this problem?

TIA

Andy
 
You can custom code this using the .NET classes ("decompiled" with Reflector
or similar) or you can use Reflection.Emit() if you want to compile a
"control" on the fly. I would aim for the server class (compiled as a
library) personally, as it is more reusable and will perf better with lots of
choices than JITting on a page by page basis (assuming you cannot cache the
control, that is).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Back
Top