Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. WebControl SPAN tag

WebControl SPAN tag

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theJazzyBrain
    wrote on last edited by
    #1

    I am creating a custom WebControl. I noticed that it wraps everything in a SPAN tag. How can I get rid of this tag? I don’t want it to appear!

    Jason Kataropoulos

    Excellence is not an act, but a habit!

    Aristotle

    T 1 Reply Last reply
    0
    • T theJazzyBrain

      I am creating a custom WebControl. I noticed that it wraps everything in a SPAN tag. How can I get rid of this tag? I don’t want it to appear!

      Jason Kataropoulos

      Excellence is not an act, but a habit!

      Aristotle

      T Offline
      T Offline
      Tom John
      wrote on last edited by
      #2

      Override the constructor of the web control and pass in a string representing the tag you want it to be rendered as: ")> _ _ Public Class TestControl Inherits WebControl Public Sub New() MyBase.New("div") End Sub Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter) writer.Write("Time Now: " & Date.Now) End Sub End Class Hope this helps Tom

      T 1 Reply Last reply
      0
      • T Tom John

        Override the constructor of the web control and pass in a string representing the tag you want it to be rendered as: ")> _ _ Public Class TestControl Inherits WebControl Public Sub New() MyBase.New("div") End Sub Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter) writer.Write("Time Now: " & Date.Now) End Sub End Class Hope this helps Tom

        T Offline
        T Offline
        theJazzyBrain
        wrote on last edited by
        #3

        Yes, this allows me to change the tag. But I dont want it changed. I want it completely removed.

        Jason Kataropoulos

        Excellence is not an act, but a habit!

        Aristotle

        T 1 Reply Last reply
        0
        • T theJazzyBrain

          Yes, this allows me to change the tag. But I dont want it changed. I want it completely removed.

          Jason Kataropoulos

          Excellence is not an act, but a habit!

          Aristotle

          T Offline
          T Offline
          Tom John
          wrote on last edited by
          #4

          Override the RenderBeginTag and RenderEndTag and just don't call the base method: Public Class TestControl Inherits WebControl Protected Overrides Sub RenderContents(ByVal writer As HtmlTextWriter) writer.Write("Time Now: " & Date.Now) End Sub Public Overrides Sub RenderBeginTag(ByVal writer As System.Web.UI.HtmlTextWriter) 'MyBase.RenderBeginTag(writer) End Sub Public Overrides Sub RenderEndTag(ByVal writer As System.Web.UI.HtmlTextWriter) 'MyBase.RenderEndTag(writer) End Sub End Class Hope this helps Tom

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups