473,657 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reusing Code



Hi all,

I've been studying ASP.Net for a couple of weeks now.And it's starting to
come to me. For me the next step is trying to figure out what is the best
way to reuse code and webforms.

For example I wrote a logon page, in combination with a user management
page(edit, create, delete, password, ...). So when I start a new project in
wich I want to use these pages and the code behind modules i want to off
course reuse these pages. How can I accomplish this the best? Are there any
tutorials or explanations available about this?

rgds,

Z.
Nov 19 '05 #1
7 1378
In ASP.NET 2.0 there are Master Pages. In 1.1 you don't have many options.
There is no visual inheritance for pages. You can make user controls if you
find it appropriate. In most of the cases you will just cut and paste.

Eliyahu

"Zodiac" <no*****@email. com> wrote in message
news:Xn******** *************** ******@207.46.2 48.16...


Hi all,

I've been studying ASP.Net for a couple of weeks now.And it's starting to
come to me. For me the next step is trying to figure out what is the best
way to reuse code and webforms.

For example I wrote a logon page, in combination with a user management
page(edit, create, delete, password, ...). So when I start a new project in wich I want to use these pages and the code behind modules i want to off
course reuse these pages. How can I accomplish this the best? Are there any tutorials or explanations available about this?

rgds,

Z.

Nov 19 '05 #2
Your best friend when it comes to code reuse is having a solid NTier
architecture and taking advantage of OO capabilities.

In your case this should mean that all the logic to edit, create, delete,
password should be in a separate class which you can simply reference from
any project.

As far as actually reusing visual components across projects, your only real
alternative is to create Server Controls which I personally find too
complicated except for in the most simple cases. Within projects you can
make use of far simpler UserControls and things such as MasterPages (which
Eliyahu talked about). MetaBuilders have a great free masterpage control
for ASP.NEt 1.1 (http://www.metabuilders.com/Tools/MasterPages.aspx) .
Having your read your email however I don't think this is particularly what
you're after. For now the best approach might be to copy/past the user
control files...which, if you have a lot of projects will become at
nightmare to maintain. Hopefully by then you'll have mastered server
controls.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Zodiac" <no*****@email. com> wrote in message
news:Xn******** *************** ******@207.46.2 48.16...


Hi all,

I've been studying ASP.Net for a couple of weeks now.And it's starting to
come to me. For me the next step is trying to figure out what is the best
way to reuse code and webforms.

For example I wrote a logon page, in combination with a user management
page(edit, create, delete, password, ...). So when I start a new project in wich I want to use these pages and the code behind modules i want to off
course reuse these pages. How can I accomplish this the best? Are there any tutorials or explanations available about this?

rgds,

Z.

Nov 19 '05 #3
Custom Server Controls migrate from one site to another without problems, as
they are simply DLLs.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:eR******** ******@TK2MSFTN GP10.phx.gbl...
In ASP.NET 2.0 there are Master Pages. In 1.1 you don't have many options.
There is no visual inheritance for pages. You can make user controls if
you
find it appropriate. In most of the cases you will just cut and paste.

Eliyahu

"Zodiac" <no*****@email. com> wrote in message
news:Xn******** *************** ******@207.46.2 48.16...


Hi all,

I've been studying ASP.Net for a couple of weeks now.And it's starting to
come to me. For me the next step is trying to figure out what is the best
way to reuse code and webforms.

For example I wrote a logon page, in combination with a user management
page(edit, create, delete, password, ...). So when I start a new project

in
wich I want to use these pages and the code behind modules i want to off
course reuse these pages. How can I accomplish this the best? Are there

any
tutorials or explanations available about this?

rgds,

Z.


Nov 19 '05 #4
Yeah, may be, once you have them and they do what you want them to. I second
Karl, they are too
complicated except for in the most simple cases. I started with them and
ended up with copy/paste. Wasted time. May be if I've tried anoher time I'd
have had more luck, but I don't think it worth trying if 2.0 is around the
corner.

Eliyahu

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:ev******** ******@tk2msftn gp13.phx.gbl...
Custom Server Controls migrate from one site to another without problems, as they are simply DLLs.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:eR******** ******@TK2MSFTN GP10.phx.gbl...
In ASP.NET 2.0 there are Master Pages. In 1.1 you don't have many options. There is no visual inheritance for pages. You can make user controls if
you
find it appropriate. In most of the cases you will just cut and paste.

Eliyahu

"Zodiac" <no*****@email. com> wrote in message
news:Xn******** *************** ******@207.46.2 48.16...


Hi all,

I've been studying ASP.Net for a couple of weeks now.And it's starting to come to me. For me the next step is trying to figure out what is the best way to reuse code and webforms.

For example I wrote a logon page, in combination with a user management
page(edit, create, delete, password, ...). So when I start a new project
in
wich I want to use these pages and the code behind modules i want to

off course reuse these pages. How can I accomplish this the best? Are there

any
tutorials or explanations available about this?

rgds,

Z.



Nov 19 '05 #5
> Yeah, may be, once you have them and they do what you want them to. I
second
The same might be (and has been) said of classes and OOP in general. Yes,
you spend more time up front. But much less in the long run. A well-designed
server control can be re-used and re-purposed many times over.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:uW******** *****@tk2msftng p13.phx.gbl... Yeah, may be, once you have them and they do what you want them to. I
second
Karl, they are too
complicated except for in the most simple cases. I started with them and
ended up with copy/paste. Wasted time. May be if I've tried anoher time
I'd
have had more luck, but I don't think it worth trying if 2.0 is around the
corner.

Eliyahu

"Kevin Spencer" <ke***@DIESPAMM ERSDIEtakempis. com> wrote in message
news:ev******** ******@tk2msftn gp13.phx.gbl...
Custom Server Controls migrate from one site to another without problems,

as
they are simply DLLs.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:eR******** ******@TK2MSFTN GP10.phx.gbl...
> In ASP.NET 2.0 there are Master Pages. In 1.1 you don't have many options. > There is no visual inheritance for pages. You can make user controls if
> you
> find it appropriate. In most of the cases you will just cut and paste.
>
> Eliyahu
>
> "Zodiac" <no*****@email. com> wrote in message
> news:Xn******** *************** ******@207.46.2 48.16...
>>
>>
>> Hi all,
>>
>> I've been studying ASP.Net for a couple of weeks now.And it's starting to >> come to me. For me the next step is trying to figure out what is the best >> way to reuse code and webforms.
>>
>> For example I wrote a logon page, in combination with a user
>> management
>> page(edit, create, delete, password, ...). So when I start a new project > in
>> wich I want to use these pages and the code behind modules i want to off >> course reuse these pages. How can I accomplish this the best? Are
>> there
> any
>> tutorials or explanations available about this?
>>
>> rgds,
>>
>> Z.
>
>



Nov 19 '05 #6
> The same might be (and has been) said of classes and OOP in general. Yes,
you spend more time up front. But much less in the long run. A well-designed server control can be re-used and re-purposed many times over.


OOP is well documented. Server controls are not. In fact, I recall that time
as months of continuous guessing. And they are good for limited well-defined
functions, not as a template for building new pages.

Eliyahu
Nov 19 '05 #7
> OOP is well documented. Server controls are not.

???

Listen, I don't need Master Pages, templates or what-have you. The way our
ASP.Net apps work, we build Server Controls that have generic HTML in them,
with an outer Div or Table as part of the Control. We position and style
them via CSS. The layout HTML code is lean and clean. No attributes, layout
tables, or inline styles. Can't get much simpler than that. Easy to
maintain, easy to upgrade, easy to re-use. I should know. I maintain them. I
upgrade them. I re-use them. I re-use them out the wazoo.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:uZ******** *****@TK2MSFTNG P15.phx.gbl...
The same might be (and has been) said of classes and OOP in general. Yes,
you spend more time up front. But much less in the long run. A

well-designed
server control can be re-used and re-purposed many times over.


OOP is well documented. Server controls are not. In fact, I recall that
time
as months of continuous guessing. And they are good for limited
well-defined
functions, not as a template for building new pages.

Eliyahu

Nov 19 '05 #8

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

Similar topics

2
9294
by: Jo Voordeckers | last post by:
Hello all, I'm pretty new to the Java newsgroups so I apologize for dropping this into several maybe offtopic groups. I'm sorry! So on to my problem... I've come to a point in our RMI application where I need to have server callbacks to the client RMI applications. I've used the technique where the client passes an UnicastRemoteObject of itself to a RMI server method that registers the clientinterface object in a Vector. Now when I do...
0
1136
by: Oleg Paraschenko | last post by:
Hello, I'd like to introduce an article which might be of some interest: Reusing XML Processing Code in non-XML Applications HTML: http://uucode.com/texts/genxml/genxml.html PDF: http://uucode.com/texts/genxml/genxml.pdf <abstract>
0
282
by: Mike | last post by:
Greetings, I have a COM+ component whose integrity I would like to maintain. In other words, I do not want to rebuild it in the .net environment. How do I go about reusing the DLL in a .net project? Thanks!
9
2347
by: Alan | last post by:
Using VC++ (1998) compiler with PFE32 editor in Win2K Pro SP4. (DigitalMars CD on order. ) The program (below) instantiates a class and then deletes it. I would have thought that reusing the deleted pointer would have caused an exception, but it does not - or my coding or thinking is incorrect? #include <iostream> using namespace std;
7
1978
by: Klaus Johannes Rusch | last post by:
Is the following code valid and supported by current implementations? function somename() { this.show = function () { document.write("somename called") } } var somename = new somename(); somename.show() Note that the class name "somename" is reused for the variable name.
4
9043
by: Old Wolf | last post by:
#include <stdio.h> #include <stdarg.h> Is this safe: void foo(const char *fmt, ...) { va_list ap; va_start(ap,fmt);
2
1184
by: Andy Fish | last post by:
Hi, With languages like c# having namespaces, I was wondering what's the recommended practice for reusing source code. I'm not talking big stuff like log4net that's version controlled and usually distributed as binaries, just packages of a few classes. a typical small component will be distributed as open source with a copyright statement and will usually include a project file and use a namespace of the author's own choosing....
3
1066
by: Vik | last post by:
I use the same dataadapters and datasets on a few aspx pages. Currently I create these data controls on each page. Is it possible to create these controls only once and then use them on the different pages? Thanks.
3
8616
by: garyusenet | last post by:
Dear Professionals, I have recently been using the wonderful krypton toolkit and am trying to use them in my small hobby application. I include this bit of info as an aside really because i'm sure my question can be extrapolated to the more general case, so here goes! I have a box standard windows forms project. (File, New Project, Windows Application, OK)
0
8319
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
8837
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
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8512
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6175
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
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4171
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...
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.