473,399 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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
CompositeControl classes?

And when should a custom control implement INamingContainer?

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 INamingContainer?

Thanks,

Miguel
Dec 19 '07 #1
6 2604
System.Web.UI.Control is the base class for all ASP.Net Controls.
System.Web.UI.WebControls.WebControl 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.CompositeControl is the base class for all
WebControls that host other System.Web.UI.Controls. 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 INamingContainer, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContainer Control in which they are hosted.

You probably want to create a CompositeControl. 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**********************************@f3g2000h sg.googlegroups.com...
Hello,

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

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

And when should a custom control implement INamingContainer?

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 INamingContainer?

Thanks,

Miguel

Dec 20 '07 #2
On Dec 20, 12:39 pm, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
System.Web.UI.Control is the base class for all ASP.Net Controls.
System.Web.UI.WebControls.WebControl 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.CompositeControl is the base class for all
WebControls that host other System.Web.UI.Controls. 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 INamingContainer, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContainer Control in which they are hosted.

You probably want to create a CompositeControl. 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**********************************@f3g2000h sg.googlegroups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeControl classes?
And when should a custom control implement INamingContainer?
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 INamingContainer?
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
INamingContainer, 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...@nothinks.com>
wrote:
System.Web.UI.Control is the base class for all ASP.Net Controls.
System.Web.UI.WebControls.WebControl 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.CompositeControl is the base class for all
WebControls that host other System.Web.UI.Controls. 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 INamingContainer, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContainer Control in which they are hosted.

You probably want to create a CompositeControl. 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**********************************@f3g2000h sg.googlegroups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeControl classes?
And when should a custom control implement INamingContainer?
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 INamingContainer?
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
INamingContainer, 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**********************************@b1g2000p ra.googlegroups.com...
On Dec 20, 12:39 pm, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
>System.Web.UI.Control is the base class for all ASP.Net Controls.
System.Web.UI.WebControls.WebControl 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.CompositeControl is the base class for all
WebControls that host other System.Web.UI.Controls. 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 INamingContainer, which is an interface that
ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContainer Control in which they are hosted.

You probably want to create a CompositeControl. 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**********************************@f3g2000 hsg.googlegroups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeControl classes?
And when should a custom control implement INamingContainer?
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 INamingContainer?
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
INamingContainer, 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...@discussions.microsoft.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...@nothinks.com>
wrote:
System.Web.UI.Control is the base class for all ASP.Net Controls.
System.Web.UI.WebControls.WebControl 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.CompositeControl is the base class for all
WebControls that host other System.Web.UI.Controls. 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 INamingContainer, which is an interface that ensures
that each Control has a unique ClientID, by combining their ID properties
with the INamingContainer Control in which they are hosted.
You probably want to create a CompositeControl. 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**********************************@f3g2000 hsg.googlegroups.com...
Hello,
I am working in a class library with various custom controls.
In which cases should a control inherit Control, WebControl and
CompositeControl classes?
And when should a custom control implement INamingContainer?
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 INamingContainer?
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
INamingContainer, 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
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...
1
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...
1
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...
2
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...
1
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...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
0
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...
3
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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...
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,...

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.