473,756 Members | 3,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to apply master pages to ascx files.

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
Aug 2 '07 #1
4 1322
On Aug 2, 11:09 pm, "Max2006" <alanal...@news group.nospamwro te:
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/...le.php/c11939/

Aug 2 '07 #2
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 (wa****@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.

Aug 3 '07 #3
"Max2006" <al*******@news group.nospamwro te in message
news:Og******** ******@TK2MSFTN GP06.phx.gbl...
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...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 3 '07 #4
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 (wa****@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.

Aug 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1731
by: Nils Magnus Englund | last post by:
Hi! I'm playing around with Wilson's master pages for ASP.NET 1.1. It seems ok, but I'm really struggling with the following two problems: 1) I want all .aspx pages to inherit from the same codebehind (lots of static content). Some pages have a different menu. I want to be able to, in the individual .aspx pages, be able to add e.g. <mp:content id="menu"
0
1717
by: damiensawyer | last post by:
Hello all, I'm very new to all of this. I have a theme and a skin (the standard ones). I have a standard master page which is holding a custom ascx which has a treeview in it. Can someone please point me in the right direction to bind a theme to the treeview? The 'theme' tag is on the <%@ page %> directive... however neither my master page or ASCX files use this. They use <%Master%> and
2
3089
by: Scott | last post by:
I'm using a master page (mp_TableMaint.aspx) with one Content area (ID: Content1). Content1 contains several usercontrols, which are hidden. The goal is to show the correct control based on the querystring passed when calling mp_TableMaint (the page is called from an ASP.NET 2.0 Menu control on my index.aspx page). I believe I understand correctly that the Master Page's ASP Content control (named Content1) is, itself, a server side...
5
1955
by: Paul | last post by:
I have a MasterPage that has on it several UserControls (*ascx files). I wish to control the visibility of the controls on the content pages according to some parameter (for example on a user control that depends on a param StoreID, for the UserControl to be visible only if StoreID is in the query string.) How can I access a UserControl in a MasterPage from a Content page? I tried this, and variations thereof, but get errors: ...
1
3817
by: xs | last post by:
Hi, Is it possible to access Master Pages from Ascx directly? In an Aspx, by entering the following , <%@ MasterType VirtualPath="~/Pages/Master.Master"%> , I can easily access its property using this.Master. But can I do that using Ascx controls? What can I do to access it directly? Thanks
9
3934
by: Andy | last post by:
Hey all, I'm building out my first project using asp.net v2.0 master pages. It seems that when you use master pages and try to reference document.body.scrollTop it allways = zero/0. The same code works in a regular .htm file. Has anyone else seen this? Anyone know how to get the body.scrollTop property using masterpages. Thanks for any help Andy
4
3920
by: Diane Yocom | last post by:
I'm trying to use an Atlas UpdatePanel to just update a label when a text box has changed. The problem is that my textbox is in a user control and I'm using Master Pages - with the combination of these two things, the page flashes everytime my textbox changes and the panel is updated. If I just use a regular textbox along with the Master Page, it works fine. If I use by user control without the Master Pages, it works fine. When I...
0
2819
by: Daniel Magliola | last post by:
I'm having a weird behaviour when implementing localization resource files in my website. This looks like a .Net bug to me, but it's too obvious to be there, so I must be overlooking something. I have the following file structure: + root folder |-----Masterpage.master |-----Somepage.aspx
0
2192
by: robgallen | last post by:
I have 2 user controls within a master page, and I would like one of them to call a function in the other. All the examples I have seen involve a page communicating with the Master page, or with a user control communicating with the Master page, not with a user control directly talking to another user control, bypassing the page itself. So, I have the following files: Haep.master - which contains:
0
9275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10034
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7248
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.