Reputation: 1584
I want a method that does as follows:
GenerateMarkup(Label l); ==> output is '>asp:label runat="server" ID="label1"/<' and I'm wondering if there's any of-the-shelf method instead of doing it my self.
Upvotes: 0
Views: 118
Reputation: 30855
Yes, there exists code that helps with this. Basically, you're talking about compiling your input into some sort of output.
In your case, you're compiling some input into an .ASCX file (probably with a code-behind).
This code project covers dynamically generating ASP.NET pages and does a pretty good job of explaining the process.
http://www.codeproject.com/KB/XML/xmlxsltransformer.aspx
Upvotes: 1