Alternative to Panel Control

Discussion in 'ASP .Net' started by Guadala Harry, Apr 29, 2005.

  1. AFAIK, the Panel control renders as a <SPAN> in the rendered HTML.

    Is there an alternative to Panel that renders NOTHING?

    Here is what I'm doing:
    I need to place a bunch of HTML in an ASCX - but cause only some of it to be
    rendered based on runtime conditions. I currently have the behaviour I want,
    but by using multiple Panel controls that encompass the sections of HTML
    that are to be rendered. My code-behind logic makes sets the .visible
    property of the Panel controls.

    I just want to do the same thing - but not have the SPAN elementes show up
    in the rendered page.

    Guadala Harry, Apr 29, 2005
    1. Advertisements

  2. Guadala Harry

    Axel Dahmen Guest

    I have the same trouble. Using the asp:panel control is particularly
    pointless when you're trying to hide some table rows with it.

    Have you tried to create your own Panel control by deriving from the
    asp:panel control and overwriting its Render methods?

    Axel Dahmen
    Axel Dahmen, Apr 29, 2005
    1. Advertisements

  3. Patrick Olurotimi Ige, Apr 29, 2005
  4. Guadala Harry

    TJS Guest

    use the div tag

    <div id="whatever" Visible="true" runat="server"></div>
    TJS, Apr 29, 2005
  5. Guadala Harry

    Axel Dahmen Guest

    ....I should add that it's as simple as just deriving from asp:panel and add
    two empty render functions: RenderBeginTag() and RenderEndTag(). Then no
    <span></span> will be created.
    Axel Dahmen, Apr 29, 2005
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.