Groups | Blog | Home
all groups > asp.net building controls > april 2005 >

asp.net building controls : Transform html to code


Steve
4/10/2005 9:15:02 AM
Is there a class that will assist with taking existing aspx markup from a
file and creating a sort of tree structure that will allow you to transform
the html layout to code?

Example aspx code:

<asp:Table runat=server>
<asp:TableRow>
<asp:TableCell>
<asp:Label id=mylabel>test</asp:Label>
</asp:TableCell>
</asp:TableRow>
</asp:Table>

Resulting code:

Table t= new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();
Label lbl = new Label();
lbl.Text = "test";
tc.Controls.Add(lbl);
tr.Cells.Add(tc);
t.Rows.Add(tr);

Thanks,
Kannan.V [MCSD.net]
4/11/2005 4:17:02 AM
hi steve,

I havent heard of it till now, somebody else might.....
Nice idea for a small application.......to be written.....

Some ideas just in case nothing is available.....
The file structure is similar to an XML file, so the aspx file can be read
and the code can be generated using the XML tags.......in the way u wanted.

regds
Kannan.V

[quoted text, click to view]
Steve
4/11/2005 10:55:04 AM
Kannan,

Thank you for the response. I may pursue it in the future when I have more
time. Do you know if C# supports some kind of eval function that would
attempt to create a new instance of whatever tag name it found or would you
have to evaluate each tag name on a case-by-case basis?

Steve

[quoted text, click to view]
Kannan.V [MCSD.net]
4/11/2005 11:25:01 PM
hi steve,

Thinking of doing something similar when i get some free time
Not sure of any C# eval function.
We need to do it on a case by case basis.

Having a faint idea on using XML and XSLT to loop thro similar tags and
having XSLT convert them, this will be something similar to coverting XL data
to XML and XML data to XL using XSLT's.....

need to a lot more research into that......
wishing u good luck on ur quest.

thanks
Kannan.V

[quoted text, click to view]
AddThis Social Bookmark Button