473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Multiple *.ascx files with a single *.ascx.cs in VS.NET 2003

Hi all,

I'd like to have several "skins" for an application that are
"structurally different" (i.e. controls at different locations, some
controls visible only in a particular "skin"). The application is
implemented with a single default.aspx which loads a couple of
ascx-Controls (navigation, contents depending on parameter and so on).

Now, an obvious approach is simply duplicating the ascx-Files into an
own directory structure which resembles the original directory
structure, but keeping the codebehind files (*.ascx.cs) at the original
location (and only once, as the functionality should remain the same and
I don't uselessly duplicate code).

I can then "switch skins" by simply changing the path in the default.aspx.

This approach works fine for the running application, but VS.NET 2003
doesn't like it very much - at least not for the designer. I've tried
changing the path to the code behind file so that it is correct, but
still it says it cannot load the code behind file (it does work for the
original ascx-file, with a path like ../../../<pathback> which would be
the same in the "other skin directory").

Is there any way to go with this approach and still use the designer?
Would be using an alternative tool (e.g. Dreamweaver) solve this problem?

Is there a different, possible more elegant approach to this? I'd do
this with different CSS style sheets if the structure wasn't so different...

kind regards and thanks a lot for any help,
david
Nov 18 '05 #1
2 1796
Option 1:
Create a class file that has the actual code. Create the click events, et
al, in each skin. The code is still in one place, except event handlers.

Option 2:
Look at .NET Nuke, which has a skinning engine. Not as easy to use as
clicking each page, but much quicker.

Option 3:
Wait for themes in .NET 2.0.

Option 4:
?

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Holger (David) Wagner" <da***@purple-sunshine.de> wrote in message
news:cc**********@svr7.m-online.net...
Hi all,

I'd like to have several "skins" for an application that are
"structurally different" (i.e. controls at different locations, some
controls visible only in a particular "skin"). The application is
implemented with a single default.aspx which loads a couple of
ascx-Controls (navigation, contents depending on parameter and so on).

Now, an obvious approach is simply duplicating the ascx-Files into an
own directory structure which resembles the original directory
structure, but keeping the codebehind files (*.ascx.cs) at the original
location (and only once, as the functionality should remain the same and
I don't uselessly duplicate code).

I can then "switch skins" by simply changing the path in the default.aspx.

This approach works fine for the running application, but VS.NET 2003
doesn't like it very much - at least not for the designer. I've tried
changing the path to the code behind file so that it is correct, but
still it says it cannot load the code behind file (it does work for the
original ascx-file, with a path like ../../../<pathback> which would be
the same in the "other skin directory").

Is there any way to go with this approach and still use the designer?
Would be using an alternative tool (e.g. Dreamweaver) solve this problem?

Is there a different, possible more elegant approach to this? I'd do
this with different CSS style sheets if the structure wasn't so different...
kind regards and thanks a lot for any help,
david

Nov 18 '05 #2
Hi Greg,

Cowboy (Gregory A. Beamer) [MVP] wrote:
Option 1:
Create a class file that has the actual code. Create the click events, et
al, in each skin. The code is still in one place, except event handlers.
So would that class file be the superclass of the code-behind
file/class? In that case, I'd still have to push up the members of the
"original code behind file" up on level. If not, I'd still need some way
of accessing the widgets which again would mean duplicated code (even
though that duplicated code would be rather simple)...
Option 2:
Look at .NET Nuke, which has a skinning engine. Not as easy to use as
clicking each page, but much quicker.
I haven't really looked deep into this, but it seems that dot net nuke
is something to be used right from the start of a project. We already
have an existing application that shall still work when we add a similar
application for a different client with different look (and a few added
functionalities).
Option 3:
Wait for themes in .NET 2.0.


We have actually considered trying .NET 2.0 - but as this is a system
that goes to production in August (2004), we'd rather use stable
technology...

kind regards,
david
Nov 18 '05 #3

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

Similar topics

1
by: kbailey | last post by:
what a waste of money. visual studio does not handle user control files - these are files with and ascx extension are are refered to in the help as 'user-authored server controls'. the VS...
4
by: Bogosian | last post by:
I am working on an asp.net project.There is a subdir called OSearch,with a few aspx pages in it which as all other pages on the website use some controls.These controls are stored in a another...
2
by: James X. Li | last post by:
Is there a way to implement multiple login forms for ASP.NET applications? With our application we want to implement simple login form for normal resources (downloadable files), but more rigorous...
1
by: Jouni Heikniemi | last post by:
Hi, This has been asked before, in <http://groups.google.fi/groups? selm=ureiu7b04kv839%40corp.supernews.com> for example; however, I haven't found any real answers, so I'll post this with some...
3
by: Shikari Shambu | last post by:
Hi All, I have a situation where multiple applications are sharing some pages/ controls. So, I have a separate common project that has the common pages/ controls. My question is how do I...
4
by: ChrisB | last post by:
Hi - I'm just trying to figure out what would be involved with deploying a simple HTML update to an ASCX file. Where there were no changes to the code behind (compiled code), to deploy this to...
2
by: Bogdan Nedelcu | last post by:
I've done some research on the net and found a tool to precompile the ASCX code. (CodeProject http://www.codeproject.com/aspnet/ascxparser.asp) I wonder why the guys from ASP.NET do not provide a...
10
by: eswanson | last post by:
I have broken up my web site into smaller web site projects. When I look at the precompiled files, it always has the virtual directory in them ie: <preserve resultType="3"...
11
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine Windows Server 2003 using IIS 6.0 and I am getting the error BC30560 prjob_ascx is ambiguous in the namespace ASP I found a fix. Deleting all the files in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.