HOWTO: Remove <span> tag from Panel and PlaceHolder WebControls?

Discussion in 'ASP .Net' started by Don Wash, Sep 6, 2004.

  1. Don Wash

    Don Wash Guest

    Hi There!

    I'm creating my website with ASP.NET + XHTML, which means I will strictly
    adhere the XHTML standards for my web page output.

    I use Panel or PlaceHolder WebControls to place dynamically created
    <div></div> contents to my web pages.

    But the problem arises when because Panel and PlaceHolder WebControls do
    extra work with <span> tags as follows...

    Panel Control...
    <div><span></span><div>

    PlaceHolder Control...
    <span><div><div></span>

    In XHTML, it is not allowed to nest a <div> tag within a <span> tag. So
    PlaceHolder control is now out of the question. So I use Panel control but
    then it inserts the <span> tag inside the <div> tag (which is valid by the
    way) BUT I need to insert <div> content to the Panel control from server
    side. So the final output become something like this...

    Using Panel Control...
    <div><span><div id="MyOwnContent">Test</div></span><div>

    So as you can see, now my "MyOwnContent" <div> tag is inside auto generated
    <span> tag of the Panel control. So now my web page XHTML is invalid again.

    How do I workaround this? Is there any properties that will turn off from
    ..NET automatically inserting <span> tags?

    Thanks in advance,
    Don
    Don Wash, Sep 6, 2004
    #1
    1. Advertising

  2. Don Wash

    Rutger Smit Guest

    Don Wash wrote:

    > Hi There!
    >
    > I'm creating my website with ASP.NET + XHTML, which means I will strictly
    > adhere the XHTML standards for my web page output.
    >
    > I use Panel or PlaceHolder WebControls to place dynamically created
    > <div></div> contents to my web pages.
    >
    > But the problem arises when because Panel and PlaceHolder WebControls do
    > extra work with <span> tags as follows...
    >
    > Panel Control...
    > <div><span></span><div>
    >
    > PlaceHolder Control...
    > <span><div><div></span>
    >
    > In XHTML, it is not allowed to nest a <div> tag within a <span> tag. So
    > PlaceHolder control is now out of the question. So I use Panel control but
    > then it inserts the <span> tag inside the <div> tag (which is valid by the
    > way) BUT I need to insert <div> content to the Panel control from server
    > side. So the final output become something like this...
    >
    > Using Panel Control...
    > <div><span><div id="MyOwnContent">Test</div></span><div>
    >
    > So as you can see, now my "MyOwnContent" <div> tag is inside auto generated
    > <span> tag of the Panel control. So now my web page XHTML is invalid again.
    >
    > How do I workaround this? Is there any properties that will turn off from
    > .NET automatically inserting <span> tags?
    >
    > Thanks in advance,
    > Don
    >
    >



    Why not writing your own server control?
    With a good book about server controls it won't be that dificult.
    Writing an alternative for the Placeholder or Panel control is the
    simples example IMHO.

    Reccomended book: http://www.microsoft.com/MSPress/books/5728.asp

    --

    //Rutger


    www.RutgerSmit.com
    Rutger Smit, Sep 6, 2004
    #2
    1. Advertising

  3. Don Wash

    Don Wash Guest

    ....

    Don

    "Don Wash" <> wrote in message
    news:e4%...
    > Hi There!
    >
    > I'm creating my website with ASP.NET + XHTML, which means I will strictly
    > adhere the XHTML standards for my web page output.
    >
    > I use Panel or PlaceHolder WebControls to place dynamically created
    > <div></div> contents to my web pages.
    >
    > But the problem arises when because Panel and PlaceHolder WebControls do
    > extra work with <span> tags as follows...
    >
    > Panel Control...
    > <div><span></span><div>
    >
    > PlaceHolder Control...
    > <span><div><div></span>
    >
    > In XHTML, it is not allowed to nest a <div> tag within a <span> tag. So
    > PlaceHolder control is now out of the question. So I use Panel control but
    > then it inserts the <span> tag inside the <div> tag (which is valid by the
    > way) BUT I need to insert <div> content to the Panel control from server
    > side. So the final output become something like this...
    >
    > Using Panel Control...
    > <div><span><div id="MyOwnContent">Test</div></span><div>
    >
    > So as you can see, now my "MyOwnContent" <div> tag is inside auto
    > generated <span> tag of the Panel control. So now my web page XHTML is
    > invalid again.
    >
    > How do I workaround this? Is there any properties that will turn off from
    > .NET automatically inserting <span> tags?
    >
    > Thanks in advance,
    > Don
    >
    Don Wash, Sep 7, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Nicholson

    WebControls.Panel versus DIV tag

    Rob Nicholson, Feb 24, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,918
    Rob Nicholson
    Feb 25, 2005
  2. shruds
    Replies:
    1
    Views:
    779
    John C. Bollinger
    Jan 27, 2006
  3. nail

    Build control in a placeholder or like a placeholder

    nail, Sep 10, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    331
  4. Replies:
    0
    Views:
    269
  5. Wang, Jay
    Replies:
    5
    Views:
    467
    Wang, Jay
    May 25, 2004
Loading...

Share This Page