Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

How to apply master pages to ascx files.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Max2006 - 02 Aug 2007 22:09 GMT
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
Alexey Smirnov - 02 Aug 2007 22:30 GMT
> Hi,
>
[quoted text clipped - 5 lines]
> 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/
Walter Wang [MSFT] - 03 Aug 2007 07:50 GMT
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 (wawang@online.microsoft.com, 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.
Walter Wang [MSFT] - 07 Aug 2007 09:52 GMT
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 (wawang@online.microsoft.com, 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.
Mark Rae [MVP] - 03 Aug 2007 08:52 GMT
> 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...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.