Web form inheritance?

J

Joe

We are working on a project that requires 3rd parties (ie, consultants) to
use our ASP.net webforms in a very reusable manner. The big catch is that
we are not allowed to give them source. There are a group of screens that
they all need to use in other applications, but need the ability to
customize some of the simpler behavior.

Some of the problems we are having include:

- they of course want to to be able to jump into and out of the "common"
pages. That is, they want to load our reusable pages, and then when the
user is done with the page, jump back into a specific page in their
applications.
- They want to do simple customizations of the page - like include a
different logo, maybe include or exclude certain controls, etc. We are
still thinking this part through.
- It seems that with precompilation, we get a separate assembly for each
page, and the name of the generated dll seems to be somewhat random. We
havent figured out how to map the dll name to which page it is.

The first thought that occurred to us is to use some form of form
inheritance. If memory serves, Windows Forms allow some cool form
inheritance features. Does Web Forms allow the same kind of functionality?

Does anyone have any best practices for how to do this? Please keep in mind
that we are only allowed to ship the assemblies, and not source code to the
clients.

Thanks for any info,

joe
 
S

Steven Cheng[MSFT]

Hello Joe,

Welcome to the ASPNET newsgroup.

From your description, you're going to develop an ASP.NET (2.0?) web
application framework which will provide the sufficient flexiblity and
reusablity so that other vendors or users will be able to customize it
easily, correct?

Based on my experience, here are some of my understanding and suggestions:

1. ASP.NET 2.0 has naturally support visual inheritance through the
MasterPage feature. Master page is somewhat like a page template where we
can define some common UI elements(such as logo, banner, side navigation
bar, etc...). Then, other concrete pages in our web application can apply
this master page so that those common UI elements will be inherited from
the master page(note that the implementation of masterpage is not class
level inheritance in OO, but the "aggregation" model). In another word,
visual inheritance is not actual OO inheritance. Such visual inheritance
can make our web site's pages be consistent in UI, and easy to modify it
(we only need to modify the master page when necessary). However, for your
scenario, it won't be quite easy to be further reused after precompilation.


2. To make the #1 abit more flexible, you can consider constructing the
master page UI through code dynamically, e.g. the logo, banner or
navigatino bars in the master page can be loaded at runtime(from other
separate ascx usercontrols).


3. If we want the most flexibility and reusability, we can also consider
defining a base page class completely from scratch, the base page class
will purely use code to programmatically construct the UI (from some
external template files or usercontrols). However, in this approach, we'll
lose the convenience provided by the built-in features in ASP.NET 2.0 (such
as master page). Also, generally speaking, the more we provide on
flexibility, the more we'll lose in performance.

Here are some web articles I've searched over internet some of which have
mentioned some of the approach I mentioned:

#Building Re-Usable ASP.NET User Control and Page Libraries with VS 2005
http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx

#Master Your Site Design with Visual Inheritance and Page Templates
http://msdn.microsoft.com/msdnmag/issues/04/06/ASPNET20MasterPages/

#Creating Usable Page Templates in ASP.NET
http://www.devx.com/dotnet/Article/18011

#Creating Reusable Content in ASP.NET
http://www.informit.com/articles/article.asp?p=173411&rl=1

In addition, I suggest you also have a look at some well-know 3rd party web
application framework such as the dotnetnuke. Maybe you can get some good
ideas from them.

Hope this helps some.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

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.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

Joe

Hi Steven -

WOW! That was fast, must be a new record for a response.

Thanks for your response, it is appreciated.

Yes, it is ASP.Net 2.0.

If I understand you correctly, I am not sure if Master Pages will fit the
bill for what we need. Our problem isnt only that the pages should be
consistent, but we have to provide stock functionality through our 3 tier
implementation (ie, UI, Middle Tier, DB). Our general design philosophy is
to create user controls that deal with calling the M/T, and then we
aggregate these user controls into each page.

What we are looking for is a way to allow 3rd parties to use these pages
(with the embedded user controls) with slight modifications. Best example
of one of those modifications is to allow the 3rd party to specify the
destination page when the user hits "ok" on one of our pages. So we are
essentially giving them stock functionality, and allowing them to completely
integrate it into a new application seamlessly.

But our solution must be such that the 3rd party doesnt receive any source
code from us. Binaries only.

I hope this explains our problem a little better.

I have not yet read the links you pointed me to, but will in the morning.

Thanks again,

Joe
 
S

Steven Cheng[MSFT]

Thanks for your response Joe,

Yes, you're right, MasterPage can not provide the ability for binary level
reusability, but only provide us visual inheritance(make page UI
consistent) at development time.

Actually I did notice your requirement as below
==============
But our solution must be such that the 3rd party doesnt receive any source
code from us. Binaries only.
=============
in your first message. Thereforce I've mentioned that masterpage will not
quite work if you want to further reuse your webproject at binary
(precompiled) level and delivered to other vendors. If you have looked at
the following article I mentioend:

http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx

You'll find scottgu(the ASP.NET team's pm) have pointed out a way to reuse
precompiled ascx usercontrols or aspx pages. Frankly speaking, IMO I still
do not quite recommend this because ASP.NET is not naturally designed for
such reusability (like other normal class libraries). And the approach
Scott mentioned is just a trick rely on the new ASP.NET 2.0's
precompilation and dynamic comilation model. Anyway, you can have a look to
see whether it can help for your scenario.

Further more, just like #3 in my last message, another means is design a
complete dynamic (pluggable ) page framework ourselves. A common approach
is partition page form into several sections and each section will
dynamically load the UI element at runtime(such as load ascx usercontrols).
Thus, we can precompiled our web application(framework) as binary, and the
end user can customize them by replace some of the UI fragments (ascx
usercontrols) as they want.

Hope this help clarify some further. Also, please feel free to post here
if you have any other ideas or consideration. And any feedback is welcome:)

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

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.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

Hi Joe,

How are you doing on this issue? Have you got any further progress or does
my last reply helps a little? If there is anything else we can help, please
feel free to post here.

Regards,

Steven Cheng
Microsoft MSDN Online Support Lead


==================================================

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.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top