G
George Ter-Saakov
I am trying to create templatable user control.
So idea is to have code in .cs files and HTML (with server control declarations) in the .ascx files.
Control has one .cs file since functionality does not depend on selected template.
Control should/might have multiple templates (ascx files).
Problem: template is selected in run time.
How is it done?
One of the examples is "Community Server". Page simply consist of directives to include UserControls (besides of HTML) like
<%@ Register TagPrefix="Galleries" Namespace="CommunityServer.Galleries.Controls" Assembly="CommunityServer.Galleries" %>
<Galleries:AggregatePortalPictureListing EnableTitle="false" Count="5" ...../>
And then in themes folder there are files "Skin-AggregatePortalPictureListing.ascx" one for each different theme.
So as you can see there is one compiled class CommunityServer.Galleries.Controls.AggregatePortalPictureListing which in runtime based on selected theme loads "Skin-AggregatePortalPictureListing.ascx" from appropriate folder and hooks up all event handlers and controls to member variables....
Thanks
George.
So idea is to have code in .cs files and HTML (with server control declarations) in the .ascx files.
Control has one .cs file since functionality does not depend on selected template.
Control should/might have multiple templates (ascx files).
Problem: template is selected in run time.
How is it done?
One of the examples is "Community Server". Page simply consist of directives to include UserControls (besides of HTML) like
<%@ Register TagPrefix="Galleries" Namespace="CommunityServer.Galleries.Controls" Assembly="CommunityServer.Galleries" %>
<Galleries:AggregatePortalPictureListing EnableTitle="false" Count="5" ...../>
And then in themes folder there are files "Skin-AggregatePortalPictureListing.ascx" one for each different theme.
So as you can see there is one compiled class CommunityServer.Galleries.Controls.AggregatePortalPictureListing which in runtime based on selected theme loads "Skin-AggregatePortalPictureListing.ascx" from appropriate folder and hooks up all event handlers and controls to member variables....
Thanks
George.