Someone please save me from myself!!! ASP.Net templates??

R

Rob Meade

Hi all,

Ok - this is a last ditched attempt to try and work out why what I want to
do is sooo complicated, and which is the best approach to do what I want...

The aim...

I want to create a standard template that myself and fellow developers here
will use for our applications, previously we did this in ASP using include
files etc - we have no moved to ASP.Net.

I want the template to exist at 'root' level on our domain - and then each
developer to be able to point back to it to use the common parts, in total
there are 9 sections to the template, 1 for the application, 2 sections
which are local to the applicaiton (logo and navigation) - the other 6 are
always going to be the same (hence wanting them at root level incase they
need to be changed etc).

If possible I would also like to be able to either, copy and paste a generic
template.aspx file from our /template applicaiton living on the root of the
server into a new application - ie, so its quick and easy for us all to
start building, or to have the 6 common sections available on the toolbar
within Visual Studio so that they can get the template.aspx file with the
table in it - and then drag and drop into the correct locations (the first
option would be preferred but it would be handy to have both)..

I have already tried using Web User Controls (.ascx files) - I created all
of the sections and then could drag and drop and it not only looked good but
it work! Then I discovered that these need to be in each application which
is no good for the 6 common parts as I want them only ONCE (incase they
change etc)...

I then moved to using Web Custom Controls - I must have clearly
misunderstood something along the way, because I created 6 Web Control
Libraries (one for each of the 6 sections) - following the instructions on
the MS site :


Once I had created them I used output.WriteLine to create the html content
for the sections - save each one - then built each one - this then created 6
..dll files locally on my PC (not on the server) - from here I followed the
instructions to add them to the toolbar - once I had them this far it was
then a case of dragging and dropping them onto the page in the html table -
I did this - but then I noticed that as I did it had created them in the
application under IIS - this got VERY confusing - as I thought I was trying
to create a set of global controls that I could point to - not have
duplicated on each application as they were used (otherwise I may have just
used the .ascx files)....

My next idea was that perhaps I needed to copy these 6 .dll's onto the
server in the first instance - so in my /template application on the server
I copied them all into the /bin directory - at this stage I was then unable
to add them to the toolbar - it didnt give any errors or anything - but it
wouldnt add them - and when I opened the /template application within the
solution explorer as well as the current application to drag them onto the
page it simply placed them in as hyperlinks!!

I am now completely - COMPLETELY - confused and going off of ASP.Net very
rapidly....(I dont like losing!)...

I'm now left wondering whether the .dll (Web Control Libraries) I created
were only supposed to live locally on the PC - in which case wouldnt I now
need to add them to each of the developers PC's for them to use them? If
so - this again means that if I ever change the template I'll have to let
everyone know and we'll still have to change all of the applications. I
just cant work out where I am going wrong - what I am supposed to be
doing...

I've trawled the net for the last few days this week, and most of last week
and do not seem to be able to find any examples of people doing the same
thing, and especially nothing written for Joe Newbie...

If anyone can offer me any help for this I would be EXTREMELY grateful - I
really am pulling my hair out - and I dont actually have much anyway!

Many thanks for reading my ASP.Net epic - and I hope someone can help
me.....

Best regards

Rob
 
C

Colin Young

Have you read the article at this link (or any of the articles it links to)?
http://www.smartisans.com/articles/vb_templates.aspx

I've got a template system I use and I can post the code here (again) if you
are interested. It brings together a number of techniques from all the
articles referenced above and works by inheritance.

As far as your DLLs being copied into the multiple projects, that is normal.
If you register them in the GAC I think you will avoid that problem, but I
think that is overkill for a templating system. IIS needs the DLL in the bin
directory of the application and the difference between custom controls and
ascx controls is that the custom control only needs the DLL to share between
applications, not the source code (there are other differences, but that
seems to be the one you are most concerned about).

Colin
 
R

Rob Meade

...
Have you read the article at this link (or any of the articles it links to)?
http://www.smartisans.com/articles/vb_templates.aspx

Hi Colin, thank you for your reply.

I haven't read that article no - I will go and do so in a moment - thank
you.
I've got a template system I use and I can post the code here (again) if you
are interested. It brings together a number of techniques from all the
articles referenced above and works by inheritance.

Whilst I appreciate the offer, I think my main trouble is understanding it
all, I have managed to create the bits I want (I think!) - but I have no
idea of how to get them to work from all of the applications.
As far as your DLLs being copied into the multiple projects, that is normal.
If you register them in the GAC I think you will avoid that problem, but I
think that is overkill for a templating system. IIS needs the DLL in the bin
directory of the application and the difference between custom controls and
ascx controls is that the custom control only needs the DLL to share between
applications, not the source code (there are other differences, but that
seems to be the one you are most concerned about).

The concern I have is that if we want to say change our corporate logo that
I'm going to end up with the crappy job of having to change a logo across
say 50 applications - my understanding of the custom control was that the
..dll would be used in one location, therefore I could change it there just
the once and not in the other 50 applications. Surely if IIS has copies of
it in each application I will then need to change all of those as well???

This is what I'm struggling with...the solution explorer is now baffling me
aswell - initially I understood that what was shown there would appear
within IIS, however when I created the libraries these did not appear under
IIS?! I'm finding it really difficult to keep up with this -everytime I
make one step forward and get to a stage where it looks like its working I
take about 20 back again...

I know what GAC stands for now - having looked around - but there are a lot
of other terms that keep appearing whilst searching/asking for help which I
just dont understand. I attended a MS asp.net training course about 3 weeks
ago but it didnt cover a lot of things like this and the more problems I
have the further the things I did cover which made sense seem to fade into
the darkness...

How does one register the .dll's into the GAC - what affects does this have?
Is there anything I should be aware of before doing this - complications for
other applications etc?

Thanks again for your reply, I'm struggling so much I just wanna give up at
the moment - I hate no understanding and the learning curve from ASP to
ASP.Net seems huge....

Regards

Rob
 
R

Rob Meade

...
Have you read the article at this link (or any of the articles it links to)?
http://www.smartisans.com/articles/vb_templates.aspx

Hi again Colin,

Having read through that initial way I dont think thats what we're going to
be wanting, and I have already looked at a couple of the items on the bottom
of the page (ASP Alliance etc).

I was told by the tutor on our ASP.net course that the Web Custom Controls
were a way to enable the template to be used of multiple apps - whereas the
Web User Controls were application specific - unfortunately these things
were not covered on the course.

The code you said that you could post (again) etc - does this use Web Custom
Controls? I dont think I am in a very good position to explain exactly what
I want to do - because I dont know enough about ASP.net yet...and in a news
group I cant even 'draw' it to help describe...however I will try....

Our main domain (in the NHS) is nww.avon.nhs.uk, I have created a /template
application there,

nww.avon.nhs.uk/template

all of the other applications would be living on the server like this :

nww.avon.nhs.uk/app1
nww.avon.nhs.uk/app2

etc

Is there no way that I can say in app1 - go and get the controls I want to
use for the template from nww.avon.nhs.uk/template/control1.???

etc?

Do I need to use the 'references' in the solution explorer or are these for
something else...

Thanks again for any help,

Regards

Rob
 

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,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top