Neat ASP.NET Tip for Templating

At the AZDNUG Meeting tonight, Jason Beres of Infragistics gaveus a really cool tip for templating data repeaters based on a user profile or some other changable setting. Just create a separate user control that has your repeater template in it, and give it the name of your profile... something like "manager.ascx". Then, in the code behind of the page with the repeater, use this code:

1DataList1.ItemTemplate = Page.LoadTemplate(MySettings.Profile.Name & ".ascx")
Pretty nifty, huh? I'm going to use it to change up my company's website to be 100% virtual, using handlers, ItemTemplates, and XHEO|WebSkin.

No Comments