Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / December 2007

Tip: Looking for answers? Try searching our database.

Control. Is this possible?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shapper - 19 Dec 2007 13:09 GMT
Hello,

I have been creating a few controls and I have a problem.

I want to create a control that renders a TextBox, a Label, and a few
more controls.

Is it possible to create such a control without all these controls to
be wrapped in a Tag?

Thanks,

Miguel
Peter Bucher [MVP] - 19 Dec 2007 13:14 GMT
Hello Miguel

> I have been creating a few controls and I have a problem.
>
[quoted text clipped - 3 lines]
> Is it possible to create such a control without all these controls to
> be wrapped in a Tag?
Yes its possible.
You can use a UserControl for this requirements, or also a CustomControl
thats inherited from CompositeControl
or also from any other control.

Signature

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

shapper - 19 Dec 2007 21:34 GMT
On Dec 19, 1:14 pm, "Peter Bucher [MVP]" <peter.buc...@aspnetzone.de>
wrote:
> Hello Miguel
>
[quoted text clipped - 14 lines]
> Gruss, Peter Bucher
> Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerlandhttp://www.aspnetzone.de/- ASP.NET Zone, die ASP.NET Communityhttp://www.aspnetzone.de/blogs/peterbucher/- Auf den Spuren von .NET

Not really.

Every time I create a custom control that inherits from WebControl or
CompositeControl it renders as a Span tag with all child controls
inside it.
Of course I can change the render begin and end tag by using:

Public Overloads Overrides Sub RenderBeginTag(ByVal writer As
HtmlTextWriter)
     writer.RenderBeginTag(HtmlTextWriterTag.Div)
End Sub

But what I would like is the control to render its child controls but
not having them wrapped.
Is this possible?

Thanks,
Miguel
Peter Bucher [MVP] - 21 Dec 2007 08:22 GMT
Hallo Miguel

> But what I would like is the control to render its child controls but
> not having them wrapped.
> Is this possible?
Yes, simply overwrite the whole Render methode of your control.
Or else for an other case, overwrite the property TagKey to set a specific
tag around
instead of RenderBegin- and RenderEndTag overrides.

Signature

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.