Control. Is this possible?

S

shapper

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
 
P

Peter Bucher [MVP]

Hello Miguel
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?
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.
 
S

shapper

Hello Miguel




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.

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
 
P

Peter Bucher [MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top