473,789 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UserControl as unit of reuse - problems

hi all -
- I'm probably a) completely wrong b) the umpteenth person too
mention it - but I'm struggling to identify how to best work with
re-usable units of UI on an ASP page.

the problem is really:
1) UserControl - perfect *but* can't be re-used site wide - I *must*
be wrong on this surely...

2) Custom Control - perfect for some things - like sophisticated
controls, but I don't want to use these for everything - I'd like my
site(s) to be build almost entirely of re-usable components

any hints appreciated
Oliver
Nov 18 '05 #1
2 1046
Oliver,

I think you've got it about right. You are wrong about user controls. They
can be used site wide, but the key here is that they are application
specific. If you site is broken up into multiple applications you'll want to
use server controls instead. Yes, they are more complex, but you can use
them anywhere. That's the trade off.

Another option to create controls quickly is to use inheritance. For
example, if you need a text box to do something special, create a class
library, inherit the text box control already built into .Net and then
modify it.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Oliver" <sp************ *@yahoo.com> wrote in message
news:58******** *************** ***@posting.goo gle.com...
hi all -
- I'm probably a) completely wrong b) the umpteenth person too
mention it - but I'm struggling to identify how to best work with
re-usable units of UI on an ASP page.

the problem is really:
1) UserControl - perfect *but* can't be re-used site wide - I *must*
be wrong on this surely...

2) Custom Control - perfect for some things - like sophisticated
controls, but I don't want to use these for everything - I'd like my
site(s) to be build almost entirely of re-usable components

any hints appreciated
Oliver

Nov 18 '05 #2
Jos
Oliver wrote:
hi all -
- I'm probably a) completely wrong b) the umpteenth person too
mention it - but I'm struggling to identify how to best work with
re-usable units of UI on an ASP page.

the problem is really:
1) UserControl - perfect *but* can't be re-used site wide - I *must*
be wrong on this surely...

2) Custom Control - perfect for some things - like sophisticated
controls, but I don't want to use these for everything - I'd like my
site(s) to be build almost entirely of re-usable components

any hints appreciated
Oliver


Other key differences are:
- Custom Controls can raize their own events
- Custom Controls can be added to the toolbox, both in VS.NET and
Web Matrix.
- The custom properties for Custom Controls can also be set from the
Properties pane in these editors.
For User Controls you'll have to hand-code these properties.

--

Jos
Nov 18 '05 #3

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

Similar topics

0
930
by: Anon | last post by:
I am programmatically populating a asp.net table control with my usercontrol (PictureBox.ascx) which is basically an assortment of an imagebutton, Label and a Linkbutton. Now while debugging the application i can see that the control is being initialized properly (by setting the imgurl and text values from the db), but for some reason the usercontrol does not show up in the table. Here is the code for the Page: (test.aspx)
6
3852
by: Peter Wone | last post by:
Hosting the WebBrowser control is easy. Customising it is not. You have to implement IDocHostShowUI, IDocHostUIHandler, IDocHostUIHandler2, and IOleClientSite, not one of which appears in a typelib that I could find. With aid from around the world I did just that, and put together a comprehensive set of interfaces and enumerations, and I used them on my forms to set up the form as the client site for the browser object implementing...
4
9316
by: Dennis Burdett | last post by:
I have a pretty complex control which use to be a C# windows form that I am trying to make into a control that can be dragged onto a VB6 form. I was able to make it into a com class that I could then go to VB6 and add the reference and call the object there without any problems. When I try to make it into a UserControl, I get it to build and it registers itself during the build with no errors BUT I can not add the dll to the vb6...
5
3253
by: Guenter | last post by:
In a blog from Scott Guthrie (http://weblogs.asp.net/scottgu/archive/2005/08/28/423888.aspx) I found a sample to build a UserControl Library inside one ASP.NET project and then deploy it to other projects and reuse it. He suggests that you "publish" the web site to a directory and include this directory into your (second) web site. I tried this but VS (and the aspnet_compiler) complains that my user control now is implemented twice. When...
12
2212
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control server. It "serves" back the required control (either WebControl or UserControl) based on the contents of an xml file. The code in the webform places each control in a TableCell. My problem is that the control server works as far as returning the...
5
6529
by: shuisheng | last post by:
Dear All, I was told that unit test is a powerful tool for progamming. If I am writing a GUI code, is it possible to still using unit test? I have a little experience in using unittest++. But I can not work out a way to use it to test GUI code. Thanks a lot!
9
3180
by: Johnny Jörgensen | last post by:
Hi y'all I've got a custom control that is inherited from a normal TextBox. To that, I've added a new property that I call "Units", Which is a collection class containing members of a "Unit" class. When I put my Textbox on the form, I can access the "Units" property from the IDE's property grid, use the collection designer and add new "Unit" members to the class.
0
1390
by: =?Utf-8?B?QWtzaGF5?= | last post by:
I'm adding UserControls as WebPart at runtime to a WebPartZone. This is working fine but when I add two or more UserControl instances, the UserControls are overlapping each other i.e. When I add first UserControl it gets added successfully but when I add another UserControl to the same zone, this new UserControl overlapps the first UserControl and it gives a confusing look to the user. Also, the Title area of these webparts shows at...
2
2269
by: Joe | last post by:
Is it possible to inherit from a UserControl? If I try my user control class is not recognized. Thanks, Joe
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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
10404
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...
1
10136
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,...
0
9979
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
5415
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
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
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
3695
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.