Select Categories Below
Quomon shares its advertising revenue with contributing experts that answer questions effectively. Join our community to share your knowledge and earn an income as you go.
Status: Closed Points: 125 Time: 04:11 - Jul 19, 2007
dustPuppy
I need to make a general template for a range of usercontrols that I use on a site that I'm developing. I know that with the masterpage i can create the template for the whole site, but can it be used on a usercontrol level as well? or how do I make a template for usercontrols?
Categories:
Add Categories
When adding more than one category, separate them with commas.
Advertisement
PeterNZ
Date:: Jul 19, 2007
Time:: 15:35
No Sorry, you can't use masterpages. Two things come to my mind: First, you coul ddo this using inheritance. Create a master usercontrol and then inherit all other controls from this class. The second solution would be to use a Theme. You create a .skin file in a theme (saved to "app_themes") and set the properties you want to be the same for all controls on a page. You then apply the theme to the page like so: <%@ Page Theme="BlueTheme" %>. I personally would probably chose the inheritance from a base class. Did this help you? Cheers Peter
Time:: 16:07
Thanks, Peter. It's a pity that MS didn't think of making that as easy as the masterpage, since I think it's a pretty obvious thing to want to do. I found this info on microsofts site: http://msdn2.microsoft.com/en-us/library...(vs.80).aspx about templated user controls, I think that's the inherited solution you're talking about. Theming I think is not good enough for me, since I want to be able to not only change colors and other css-styles, but also have some repeated html-code in the tempate. Do you know about the MS way of doing it?
Date:: Jul 20, 2007
Time:: 11:48
I've implemented this approach and it works pretty well. Two things to be aware of though. In order to access any controls within the template area from the page directly, the ITemplate property of the UC needs this declared [TemplateInstance(TemplateInstance.Single)] And then the controls are not accessible before the OnPreRenderComplete event, so don't do anything with them in the Page_Load method. Thanks for pointing me in the right direction, Peter.
Question Answered
This question has been closed, and points have been rewarded to the following experts:
You're welcome however to comment or give additional information or if you wish, you have the ability to write a Tutorial in the Tutorial Area.
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
OXC control is not populated on IIS
The server responded: -ERR Message number 1823 is too large
how can i choose the best program to analysis the webpage ??
Site analysis programs Is there a consistent algorithm for all the programs a...
how to enable bluetooth on vista. i have dell vostro 1400 laptop
how do i connect a wireless printer to a laptop thats wi fi but runs internet...
You have 100 characters to use
Rank
Expert
Points
1.
9404
2.
6493
3.
5596
4.
4772
5.
3487
6.
2765
7.
2303
8.
1945
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software Real Estate Postcards Marketing Fulfillment