473,778 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Few questions on custom controls

While creating a custom control, what is the difference between

Public Class MyCls : Inherits Control

&

Public Class MyCls : Inherits WebControl

Also when should the sub Render be used & when should the sub
RenderContents be used?

Also does it make any sense in using the sub AddAttributesTo Render if
the class is being inherited from the WebControl class since the
WebControl class will always render a <spanelement?

Nov 4 '06 #1
1 1100
You should inherit from Control when your custom control doesn't have much
of any UI to display.
Inheriting from WebControl gets you everything that Control supplies plus
some extra UI goodies, such as CSS support and some other fancy UI goodies.

As for which rendering method you should use I suggest you read about
composition vs. rendering:
http://msdn.microsoft.com/library/de...srendering.asp

http://SteveOrr.net/articles/BarGraphs.aspx

And for more info about your final question I suggest you read this link:
http://geekswithblogs.net/mcastro/ar.../19/66393.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
<rn**@rediffmai l.comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
While creating a custom control, what is the difference between

Public Class MyCls : Inherits Control

&

Public Class MyCls : Inherits WebControl

Also when should the sub Render be used & when should the sub
RenderContents be used?

Also does it make any sense in using the sub AddAttributesTo Render if
the class is being inherited from the WebControl class since the
WebControl class will always render a <spanelement?

Nov 6 '06 #2

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

Similar topics

3
3989
by: Tom Bean | last post by:
I am using Dotfuscator Community Edition to obfuscate an application for Pocket PC written in C#. When I made the first pass with Dotfuscator, the app threw a MissingManifestResourceException. Of course, since the app has been obfuscated, the only information I got about what caused the error pointed to resource aq. The Dotfuscator listing window had WARNINGs about all the forms in my app, so I excluded them on the 'Rename' tab and...
5
3686
by: John Sheppard | last post by:
Hi all, I am not sure that I am posting this in the right group but here it goes anyway. I am new to socket programming and I have been searching on the internet to the questions I am about to pose but have been unsuccessful in finding the answers so far. Either because my understanding of sockets isn't where it needs to be or my questions are too basic. My programming environment is Windows XP, Visual Studio .NET 2003 and C#. So here it...
1
1710
by: Sky | last post by:
Although I've been using C# for the last month or so, and accepting out of blind faith the ViewState, I do have some nagging questions about it... can you help verify the following statements? Application is across all sessions. Session is across all pages. ViewState is sort of like Session, but for only one page. <-- Correct statement? Session is stored between page requests, somewhere in mem or IIS files --
7
3019
by: Shimon Sim | last post by:
I have a custom composite control I have following property
2
2596
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
14
4972
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons for things like delete, save, edit, cancel buttons - in the footer, or on the form detail section? 2. If in the footer, how do you add them to the tab order?
0
1742
by: Michael.Suarez | last post by:
So we develop and maintain several applications used by several people in the same company, on the same intranet. There are several applications written in VB6, but going forward all of the new development will be done in .NET 2.0, including eventual rewrites of all the VB6 apps. The VB6 executables are all stored in a network folder, and everyone accesses these exe's using shortcuts to them on their desktop. Going forward, we will...
2
1880
by: J R M | last post by:
I've developed a custom control (it's basically a drop-down list and then a couple of textboxes to include meta-data for the selection) that I'm embedding into another custom control (the idea is to allow a dynamic number of control1 to appear in control2). Everything renders correctly, however I could never retrieve data on postback from my embedded controls. Upon closer inspection, all of the embedded controls output without any "name"...
15
6522
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then i added this line "" before my custom control class (i dont know what this line does). Now
2
5576
by: Rune Jacobsen | last post by:
Hi all, I have a few questions on deriving from ScrollableControl that I hope will be relatively easy to answer. I am using Visual Studio 2003, C# and ..Net 1.1. I have this custom control I am making called ResourceView. It is supposed to show a visual overview of resource usage over time. Time is represented by the X axis, and the different resources (people, equipment, rooms etc.) are in the Y axis. Usually one will view a
0
9470
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
10298
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
7475
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
6723
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
5370
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
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
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
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2865
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.