Marco Trova's weblog

Italian .NET life

Asp.net templating issues

Lawrence gave me the opportunity to comment about implementing a template system in asp.net.

I have evaluated a lot of template systems, from Paul Wilson's MasterPages to commercial products like Xheo.WebSkin. All implemented a "static" template with custom WebControls: when page loads, it should load with that layout.

But, if you want to load dinamically a WebControl with a Button and after a Button1_Click you would change the its container layout (to show a query results, for example), you can't, because Button1_Click fires after Page's OnInit event, where you call LoadControl and asp.net fires other necessary viewstate and postback events.. ahh, if I could temporarily change the order of these events.. ;-)

Asp.net is a great programming model, but it should allow us to take place to some little hidden things.. We will wait the next version..

Comments

Paul Wilson said:

Its not easy to make it dynamic, but it is doable, as demonstrated on my site. The trick is that you have to revert back to checking the form variables in the constructor or other very early stage, instead of relying on the cool features of asp.net. Its something I'm willing to do for dynamic templates, and you only have to code it once in a base page class if you do it correctly.
# June 22, 2003 3:14 PM

Marco said:

Great Paul! This was one solution that I was thinking, too.. But, as always, there's no time to research.. :-(
# June 22, 2003 10:25 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)