Control. Is this possible?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    Control. Is this possible?

    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]

    #2
    Re: Control. Is this possible?

    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 CompositeContro l
    or also from any other control.

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


    Comment

    • shapper

      #3
      Re: Control. Is this possible?

      On Dec 19, 1:14 pm, "Peter Bucher [MVP]" <peter.buc...@a spnetzone.de>
      wrote:
      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 CompositeContro l
      or also from any other control.
      >
      --
      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
      CompositeContro l 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.RenderBe ginTag(HtmlText WriterTag.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

      Comment

      • Peter Bucher [MVP]

        #4
        Re: Control. Is this possible?

        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.

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


        Comment

        Working...