473,466 Members | 1,369 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

user controls design question

Hello,
I am trying to create a custom control hierarchy that encapsulates web
controls in my framework and run into a interesting problem.

my framework will automatically save all user control
values/preferences and initiate them from query string. My framework
will provide all necessary work and all the developers will have to do
is:
<myCo:CustomTextbox id="myText" runat="server" />
or
<myCo:CustomDropDown id="myDropDown" runat="server" />
and everything will be handled.

to achieve this, all of my controls would inherit from
CustomBaseControl which inherits WebControl, and adds additional
methods/events for improved personalization etc..

it works great, accept the web control strong typing is lost during the
declaration of the custom controls since they all inherit webcontrol.

so i cannot do
<myCo:CustomTextBox id="myText" runat="server" Text="this will berak"
/>

since c# does not support multiple inheritance, i have a choice of
inheriting from TextBox, and my own interface which would ensure that
all custom controls would implement necessary methods/event, or
inheriting from baseclass which will provide all of my controls with
common functionality, and running into the problem above.

any thoughts ?

Jul 11 '06 #1
4 1092
AFAIK you're lost on this. I also strongly suggest .NET to support multiple
inheritance.

Currently all you can do is to not derive from your base class but instead
derive e.g. from asp:TextBox and to add a single custom interface to your
class library plus a base class implementing your features and then
implement the interface using stub functions in your derived class
(=aggregation) to call the base class's function... *yuk*

HTH,
Axel Dahmen
--------------------
"sonic" <so*******@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hello,
I am trying to create a custom control hierarchy that encapsulates web
controls in my framework and run into a interesting problem.

my framework will automatically save all user control
values/preferences and initiate them from query string. My framework
will provide all necessary work and all the developers will have to do
is:
<myCo:CustomTextbox id="myText" runat="server" />
or
<myCo:CustomDropDown id="myDropDown" runat="server" />
and everything will be handled.

to achieve this, all of my controls would inherit from
CustomBaseControl which inherits WebControl, and adds additional
methods/events for improved personalization etc..

it works great, accept the web control strong typing is lost during the
declaration of the custom controls since they all inherit webcontrol.

so i cannot do
<myCo:CustomTextBox id="myText" runat="server" Text="this will berak"
/>

since c# does not support multiple inheritance, i have a choice of
inheriting from TextBox, and my own interface which would ensure that
all custom controls would implement necessary methods/event, or
inheriting from baseclass which will provide all of my controls with
common functionality, and running into the problem above.

any thoughts ?

Jul 11 '06 #2
yeah..
so what about exposing the underlying type.
if i inherit from MyCustomControl and that control handles all common
functionality, than inside of there, is generate the actual TextBox
control and render it manually.
If i expose that control developers could still access it on codebehind
files by:
((TextBox)myText.RenderedControl).Size = 20;
is it possible to do this in aspx page ?
something like:
<myCo:MyTextBox id="..." id="myText" RenderedControl-Size="30" />
etc..
would i have to do anything special to achieve this?
Axel Dahmen wrote:
AFAIK you're lost on this. I also strongly suggest .NET to support multiple
inheritance.

Currently all you can do is to not derive from your base class but instead
derive e.g. from asp:TextBox and to add a single custom interface to your
class library plus a base class implementing your features and then
implement the interface using stub functions in your derived class
(=aggregation) to call the base class's function... *yuk*

HTH,
Axel Dahmen
--------------------
"sonic" <so*******@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hello,
I am trying to create a custom control hierarchy that encapsulates web
controls in my framework and run into a interesting problem.

my framework will automatically save all user control
values/preferences and initiate them from query string. My framework
will provide all necessary work and all the developers will have to do
is:
<myCo:CustomTextbox id="myText" runat="server" />
or
<myCo:CustomDropDown id="myDropDown" runat="server" />
and everything will be handled.

to achieve this, all of my controls would inherit from
CustomBaseControl which inherits WebControl, and adds additional
methods/events for improved personalization etc..

it works great, accept the web control strong typing is lost during the
declaration of the custom controls since they all inherit webcontrol.

so i cannot do
<myCo:CustomTextBox id="myText" runat="server" Text="this will berak"
/>

since c# does not support multiple inheritance, i have a choice of
inheriting from TextBox, and my own interface which would ensure that
all custom controls would implement necessary methods/event, or
inheriting from baseclass which will provide all of my controls with
common functionality, and running into the problem above.

any thoughts ?
Jul 11 '06 #3
this no multiple inheritance is a real kick in the nuts.

Jul 11 '06 #4
how would you want to do the casting if you can't derive from it? If you're
deriving from Control you can't assign some constructor argument (or
whatever) to yourself...

nono... unfortunately this doesn't work... *sigh*
------------
"sonic" <so*******@gmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
yeah..
so what about exposing the underlying type.
if i inherit from MyCustomControl and that control handles all common
functionality, than inside of there, is generate the actual TextBox
control and render it manually.
If i expose that control developers could still access it on codebehind
files by:
((TextBox)myText.RenderedControl).Size = 20;
is it possible to do this in aspx page ?
something like:
<myCo:MyTextBox id="..." id="myText" RenderedControl-Size="30" />
etc..
would i have to do anything special to achieve this?
Axel Dahmen wrote:
AFAIK you're lost on this. I also strongly suggest .NET to support
multiple
inheritance.

Currently all you can do is to not derive from your base class but
instead
derive e.g. from asp:TextBox and to add a single custom interface to
your
class library plus a base class implementing your features and then
implement the interface using stub functions in your derived class
(=aggregation) to call the base class's function... *yuk*

HTH,
Axel Dahmen
--------------------
"sonic" <so*******@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hello,
I am trying to create a custom control hierarchy that encapsulates web
controls in my framework and run into a interesting problem.
>
my framework will automatically save all user control
values/preferences and initiate them from query string. My framework
will provide all necessary work and all the developers will have to do
is:
<myCo:CustomTextbox id="myText" runat="server" />
or
<myCo:CustomDropDown id="myDropDown" runat="server" />
and everything will be handled.
>
to achieve this, all of my controls would inherit from
CustomBaseControl which inherits WebControl, and adds additional
methods/events for improved personalization etc..
>
it works great, accept the web control strong typing is lost during
the
declaration of the custom controls since they all inherit webcontrol.
>
so i cannot do
<myCo:CustomTextBox id="myText" runat="server" Text="this will berak"
/>
>
since c# does not support multiple inheritance, i have a choice of
inheriting from TextBox, and my own interface which would ensure that
all custom controls would implement necessary methods/event, or
inheriting from baseclass which will provide all of my controls with
common functionality, and running into the problem above.
>
any thoughts ?
>

Jul 17 '06 #5

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

Similar topics

8
by: Eric Veltman | last post by:
Hello everyone, I've posted this question before, but got no answer, so I'll try to reformulate the question, maybe it helps :-) By the way, this is not intended as the start of an ASP.NET...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
0
by: Jim | last post by:
I am having some trouble with user controls and would appreciate any input / advice on where to go with this... :) 1. The first problem, and perhaps the root of the others, is that I have...
11
by: Lloyd Sheen | last post by:
Is there any one who has actually done this. I have now scanned more web articles about this with the realization that not one of them (including MSDN docs) outlines how to do this. This is...
5
by: Gopal Krish | last post by:
Wondering what's the pros and cons in creating reusable web controls using 1. User Controls 2. C# class that creates the controls programmatically Example, I want to develop a page menu...
1
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
1
by: Demetri | last post by:
I'm trying to determine if we want to use panels or user controls for our pages. Our primary concern is performance, page loading and posting speed. To illustrate my question, lets use the...
1
by: weboweb | last post by:
Hello aspnet experts! I have a design question for the more experienced developers (more than me at least :-)). 1) I have a page in the application I'm building that displays a web user...
8
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem...
1
by: Alec MacLean | last post by:
Hi, Outline of problem: I've built a set of user controls that are used to output questions for a survey and gather the responses using simple radio buttons. I'm adding an optional textbox...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
1
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
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,...
0
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...
0
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...
0
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 ...

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.