How to apply master pages to ascx files.

  • Thread starter Thread starter Max2006
  • Start date Start date
M

Max2006

Hi,

Is there any technique that allows me to have a usercontrols based on
MasterPages?
I know that MasterPages are designed for aspx pages. I wonder that I can
apply them to ascx files.

Thank you,
Max
 
Hi,

Is there any technique that allows me to have a usercontrols based on
MasterPages?
I know that MasterPages are designed for aspx pages. I wonder that I can
apply them to ascx files.

Thank you,
Max

Max, I think you can create a base class which can be inherited by all
your user controls

here's a small tip how it can be implemented (it's about aspx, but
it's the same)
http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c11939/
 
Hi Max,

I'm afraid MasterPages cannot be used on UserControl.

However, I'm not sure your objective here. Based on my understanding,
UserControl is designed to be re-used. For example: if you need to use the
controls layout in a UserControl, simply put an instance of it on your new
UserControl.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Is there any technique that allows me to have a usercontrols based on
MasterPages?

No - in fact, MasterPages are UserControls too...
I know that MasterPages are designed for aspx pages. I wonder that I can
apply them to ascx files.

Generally speaking, a UserControl is designed for re-use, so you shouldn't
need to worry about this - just drop it onto the page where required, and
let its controls assume their styles from whichever CSS is in use for the
main page...
 
Hi Max,

I'm writing to check the status of this post. Please feel free to let me
know if there's anything else I can help. Thanks.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top