473,769 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control, Web Control and Composite Control

Hello,

I am working in a class library with various custom controls.

In which cases should a control inherit Control, WebControl and
CompositeContro l classes?

And when should a custom control implement INamingContaine r?

In this moment I am working on a custom control that is composed by a
TextBox, a Label, two Validator controls and a button.

I don't want it to render a tag around these controls. Should I, in
this case, inherit it from Composite Control? And do I need to
implement INamingContaine r?

Thanks,

Miguel
Dec 19 '07 #1
6 2632
System.Web.UI.C ontrol is the base class for all ASP.Net Controls.
System.Web.UI.W ebControls.WebC ontrol inherits Control, and is the base class
for all ASP.Net WebControls. It contains a number of common properties and
methods that are used by all WebControls. You would inherit this class when
you want to employ some or all of those additional properties and methods.

System.Web.UI.W ebControls.Comp ositeControl is the base class for all
WebControls that host other System.Web.UI.C ontrols. It is used when you want
to composite a number of Controls into a single Control. It is a container
which serves as the intermediary and coordinator of the Controls it
contains. It implements INamingContaine r, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContaine r Control in which they are hosted.

You probably want to create a CompositeContro l. The following MSDN pages
should help with this:

http://msdn2.microsoft.com/en-us/library/zt27tfhy.aspx
http://msdn2.microsoft.com/en-us/library/3257x3ea.aspx

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <md*****@gmail. comwrote in message
news:0e******** *************** ***********@f3g 2000hsg.googleg roups.com...
Hello,

I am working in a class library with various custom controls.

In which cases should a control inherit Control, WebControl and
CompositeContro l classes?

And when should a custom control implement INamingContaine r?

In this moment I am working on a custom control that is composed by a
TextBox, a Label, two Validator controls and a button.

I don't want it to render a tag around these controls. Should I, in
this case, inherit it from Composite Control? And do I need to
implement INamingContaine r?

Thanks,

Miguel

Dec 20 '07 #2
On Dec 20, 12:39 pm, "Kevin Spencer" <unclechut...@n othinks.com>
wrote:
System.Web.UI.C ontrol is the base class for all ASP.Net Controls.
System.Web.UI.W ebControls.WebC ontrol inherits Control, and is the base class
for all ASP.Net WebControls. It contains a number of common properties and
methods that are used by all WebControls. You would inherit this class when
you want to employ some or all of those additional properties and methods.

System.Web.UI.W ebControls.Comp ositeControl is the base class for all
WebControls that host other System.Web.UI.C ontrols. It is used when you want
to composite a number of Controls into a single Control. It is a container
which serves as the intermediary and coordinator of the Controls it
contains. It implements INamingContaine r, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContaine r Control in which they are hosted.

You probably want to create a CompositeContro l. The following MSDN pages
should help with this:

http://msdn2.microsoft.com/en-us/lib.../3257x3ea.aspx

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <mdmo...@gmail. comwrote in message

news:0e******** *************** ***********@f3g 2000hsg.googleg roups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeContro l classes?
And when should a custom control implement INamingContaine r?
In this moment I am working on a custom control that is composed by a
TextBox, a Label, two Validator controls and a button.
I don't want it to render a tag around these controls. Should I, in
this case, inherit it from Composite Control? And do I need to
implement INamingContaine r?
Thanks,
Miguel
I am having a problem here with Composite Control. It "wrappes" the
controls in a Span Tag.
Sure I can override the BeginTag but what I would like would to not
render any tag at all.
Just renders the controls inside the custom control.

I was able to pull this by inheriting it from Control.
So I have a Custom control, inheriting Control and Implementing
INamingContaine r, which contains various controls.
This way it renders all child controls but without any wrapper tag.
Is this ok?

Thanks,
Miguel
Dec 20 '07 #3
sure, or if you want the composite control, just override RenderBeginTag and
RenderEndTag and make them nop's.

the main disadvantage of not using a span or div, is that the controls do
not have a common parent in the dom, so absolute postioning will not work
without client code to apply it to each element.

-- bruce (sqlwork.com)
"shapper" wrote:
On Dec 20, 12:39 pm, "Kevin Spencer" <unclechut...@n othinks.com>
wrote:
System.Web.UI.C ontrol is the base class for all ASP.Net Controls.
System.Web.UI.W ebControls.WebC ontrol inherits Control, and is the base class
for all ASP.Net WebControls. It contains a number of common properties and
methods that are used by all WebControls. You would inherit this class when
you want to employ some or all of those additional properties and methods.

System.Web.UI.W ebControls.Comp ositeControl is the base class for all
WebControls that host other System.Web.UI.C ontrols. It is used when you want
to composite a number of Controls into a single Control. It is a container
which serves as the intermediary and coordinator of the Controls it
contains. It implements INamingContaine r, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContaine r Control in which they are hosted.

You probably want to create a CompositeContro l. The following MSDN pages
should help with this:

http://msdn2.microsoft.com/en-us/lib.../3257x3ea.aspx

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <mdmo...@gmail. comwrote in message

news:0e******** *************** ***********@f3g 2000hsg.googleg roups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeContro l classes?
And when should a custom control implement INamingContaine r?
In this moment I am working on a custom control that is composed by a
TextBox, a Label, two Validator controls and a button.
I don't want it to render a tag around these controls. Should I, in
this case, inherit it from Composite Control? And do I need to
implement INamingContaine r?
Thanks,
Miguel

I am having a problem here with Composite Control. It "wrappes" the
controls in a Span Tag.
Sure I can override the BeginTag but what I would like would to not
render any tag at all.
Just renders the controls inside the custom control.

I was able to pull this by inheriting it from Control.
So I have a Custom control, inheriting Control and Implementing
INamingContaine r, which contains various controls.
This way it renders all child controls but without any wrapper tag.
Is this ok?

Thanks,
Miguel
Dec 20 '07 #4
Hello
sure, or if you want the composite control, just override RenderBeginTag
and
RenderEndTag and make them nop's.
Or simply overwrite the property "TagKey" and return the desired value.

--
Gruss, Peter Bucher
Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
Dec 21 '07 #5
That sounds like an excellent solution.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <md*****@gmail. comwrote in message
news:e1******** *************** ***********@b1g 2000pra.googleg roups.com...
On Dec 20, 12:39 pm, "Kevin Spencer" <unclechut...@n othinks.com>
wrote:
>System.Web.UI. Control is the base class for all ASP.Net Controls.
System.Web.UI. WebControls.Web Control inherits Control, and is the base
class
for all ASP.Net WebControls. It contains a number of common properties
and
methods that are used by all WebControls. You would inherit this class
when
you want to employ some or all of those additional properties and
methods.

System.Web.UI. WebControls.Com positeControl is the base class for all
WebControls that host other System.Web.UI.C ontrols. It is used when you
want
to composite a number of Controls into a single Control. It is a
container
which serves as the intermediary and coordinator of the Controls it
contains. It implements INamingContaine r, which is an interface that
ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContaine r Control in which they are hosted.

You probably want to create a CompositeContro l. The following MSDN pages
should help with this:

http://msdn2.microsoft.com/en-us/lib.../3257x3ea.aspx

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"shapper" <mdmo...@gmail. comwrote in message

news:0e******* *************** ************@f3 g2000hsg.google groups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeContro l classes?
And when should a custom control implement INamingContaine r?
In this moment I am working on a custom control that is composed by a
TextBox, a Label, two Validator controls and a button.
I don't want it to render a tag around these controls. Should I, in
this case, inherit it from Composite Control? And do I need to
implement INamingContaine r?
Thanks,
Miguel

I am having a problem here with Composite Control. It "wrappes" the
controls in a Span Tag.
Sure I can override the BeginTag but what I would like would to not
render any tag at all.
Just renders the controls inside the custom control.

I was able to pull this by inheriting it from Control.
So I have a Custom control, inheriting Control and Implementing
INamingContaine r, which contains various controls.
This way it renders all child controls but without any wrapper tag.
Is this ok?

Thanks,
Miguel

Dec 21 '07 #6
On Dec 20, 4:51 pm, bruce barker
<brucebar...@di scussions.micro soft.comwrote:
sure, or if you want the composite control, just override RenderBeginTag and
RenderEndTag and make them nop's.

the main disadvantage of not using a span or div, is that the controls do
not have a common parent in the dom, so absolute postioning will not work
without client code to apply it to each element.

-- bruce (sqlwork.com)

"shapper" wrote:
On Dec 20, 12:39 pm, "Kevin Spencer" <unclechut...@n othinks.com>
wrote:
System.Web.UI.C ontrol is the base class for all ASP.Net Controls.
System.Web.UI.W ebControls.WebC ontrol inherits Control, and is the base class
for all ASP.Net WebControls. It contains a number of common properties and
methods that are used by all WebControls. You would inherit this class when
you want to employ some or all of those additional properties and methods.
System.Web.UI.W ebControls.Comp ositeControl is the base class for all
WebControls that host other System.Web.UI.C ontrols. It is used when you want
to composite a number of Controls into a single Control. It is a container
which serves as the intermediary and coordinator of the Controls it
contains. It implements INamingContaine r, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContaine r Control in which they are hosted.
You probably want to create a CompositeContro l. The following MSDN pages
should help with this:
>http://msdn2.microsoft.com/en-us/lib...ttp://msdn2.mi...
--
HTH,
Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
"shapper" <mdmo...@gmail. comwrote in message
>news:0e******* *************** ************@f3 g2000hsg.google groups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeContro l classes?
And when should a custom control implement INamingContaine r?
In this moment I am working on a custom control that is composed by a
TextBox, a Label, two Validator controls and a button.
I don't want it to render a tag around these controls. Should I, in
this case, inherit it from Composite Control? And do I need to
implement INamingContaine r?
Thanks,
Miguel
I am having a problem here with Composite Control. It "wrappes" the
controls in a Span Tag.
Sure I can override the BeginTag but what I would like would to not
render any tag at all.
Just renders the controls inside the custom control.
I was able to pull this by inheriting it from Control.
So I have a Custom control, inheriting Control and Implementing
INamingContaine r, which contains various controls.
This way it renders all child controls but without any wrapper tag.
Is this ok?
Thanks,
Miguel
"sure, or if you want the composite control, just override
RenderBeginTag and
RenderEndTag and make them nop's. "

What do you mean with nop's? Can you give me a sample code?

Thanks,
Miguel
Dec 26 '07 #7

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

Similar topics

0
1587
by: Satya Bojanapally | last post by:
Hi, I am unable to add a pager for this composite control. I had created a composite control in C#. The control is having 5 labels, one radio button and one DropDownList control. The composite control should display 2 columns and 2 rows per page. I am able to display 4 Composite Controls independently, when the user is changing the index of the DropDownList control, automatcially the output should get reflected on the composite control...
1
2067
by: Paul Kia | last post by:
I have an ATL composite control which I drop into a tab control dialog page of an MFC application. When I click on the composite control and then click anywhere outside the MFC application, the application immediately hangs! Spy++ indicates that the application is hanging on the WM_GETDLGCODE message. This problem does not happen if the ATL control is a standard (that is, non-composite) control, neither does it happen if the composite...
1
3152
by: sleigh | last post by:
Hello, I'm building a web application that will build a dynamic form based upon questions in a database. This form will have several different sections that consist of a panel containing one to many questions. To keep it simple, I'll describe the basics of what I'm trying to design. I've created a TextBox composite control that consists of a label for
2
3182
by: Brian | last post by:
NOTE ALSO POSTED IN microsoft.public.dotnet.framework.aspnet.buildingcontrols I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the problems that I have encountered to date and the solutions (if any) that I found. http://users.adelphia.net/~brianpclab/ServerControlCollectionIssues.htm This page also has all of the source code in a compressed file that you are free to download...
1
1317
by: Jeff | last post by:
Hi - I am developing a composite control using VB.NET. In the ASP.NET page using the control, How can I update a label text value to reflect the value of a property of the custom control whenever the composite control is changed? The label is not a part of the custom control. I've managed to correctly set the composite control properties whenever it
7
3018
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
1407
by: multiformity | last post by:
Ok, so I have gone off and documented the lifecycle of a page with a custom composite control on it. You can find that document here: http://www.ats-engineers.com/lifecycle.htm Now, I am working on a much more complex grid example, and according to my findings, the order should be like so: Page Constructor Page OnInit
3
3005
by: Beavis | last post by:
I hate to repost a message, but I am still at the same point where I was when I originally posted, and hopefully someone else will see this one... Ok, so I have gone off and documented the lifecycle of a page with a custom composite control on it. You can find that document here: http://www.ats-engineers.com/lifecycle.htm
3
1949
by: Eric | last post by:
I have created a fairly basic composite control consisting of a Label and a TextBox. In the overridden Render function, I'm creating a table with two rows and each row contains a cell (td). The Label and the TextBox are each rendered in one of the cells. Everything renders fine. The problem is that depending on the column the control represents I may want the textbox to be a different visible size during both design and runtime. I...
0
9589
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
10212
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
9863
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
8872
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7410
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
5304
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
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
3
2815
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.