<form runat="server"> automatically adds <div> tag to code contained within. Is there a way to stop

Discussion in 'ASP .Net' started by mark4asp, Apr 2, 2007.

  1. mark4asp

    mark4asp Guest

    <form runat="server"> automatically adds <div> tag to code contained
    within. Is there a way to stop that?

    Mixing block-level elements with inline-level elements messes up the
    HTML becasuse that is invalid for a strict implementation. <span> is
    in-line-level and <div> is block-level. I don't want to mix up <span>
    and <div>

    I'm using an <asp:Button> here because when it switches to the URL I
    need to check that the user is in the correct role - their role
    determines which page they go to. Perhaps there's a better way to do
    that?, which allows me to avoid using a form and a postback here?

    Here is my server-side code:

    <tr>
    <td colspan="3">
    <a href="../Search/Search.aspx"><span class="MenuButtonLeft"
    id="cmdSearch" onmouseover="MenuButtonIn(this);"
    onmouseout="MenuButtonOut(this);">Search and Data Download</span></a>
    <span class="MenuSpacerLeft"></span>
    <form id="Form1" runat="server"><asp:Button
    ID="cmdPensionwatch" runat="server" Text="PensionWatch"
    CssClass="MenuButtonLeft2" OnCommand="cmdPensionwatch_Command" /></
    form>
    <span class="MenuSpacerLeft"></span>
    <a href="../DealFlow/DealFlow.aspx"><span
    class="MenuButtonLeft" id="cmdDealFlow"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);"
    >Deal Flow</span></a>

    <span class="MenuSpacerLeft"></span>
    <span></span>
    <a href="javascript:downloadSummaryPDF('M');"><span
    class="MenuButtonRight" id="cmd4Week"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" >4
    week Summary</span></a>
    <span class="MenuSpacerRight"></span>
    <a href="javascript:downloadSummaryPDF('F');"><span
    class="MenuButtonRight" id="cmd2Week"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" >2
    week Summary</span></a>
    <span class="MenuSpacerRight"></span>
    <a href="javascript:downloadSummaryPDF('W');"><span
    class="MenuButtonRight" id="cmd1Week"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" >1
    week Summary</span></a>
    <span class="MenuSpacerRight"></span>
    </td>
    </tr>


    This is my HTML. Notice how the inline <span> and block-level <div>
    are mixed up - ouch!


    <tr>
    <td colspan="3">
    <a href="../Search/Search.aspx"><span class="MenuButtonLeft"
    id="cmdSearch" onmouseover="MenuButtonIn(this);"
    onmouseout="MenuButtonOut(this);">Search and Data Download</span></a>
    <span class="MenuSpacerLeft"></span>
    <form name="Form1" method="post" action="News.aspx"
    id="Form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
    value="...blah...blah..." />
    </div>
    <input type="submit" name="cmdPensionwatch" value="PensionWatch"
    id="cmdPensionwatch" class="MenuButtonLeft2"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" />
    <div>

    <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION"
    value="...blah...blah..." />
    </div></form>
    <span class="MenuSpacerLeft"></span>
    <a href="../DealFlow/DealFlow.aspx"><span
    class="MenuButtonLeft" id="cmdDealFlow"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);"
    >Deal Flow</span></a>

    <span class="MenuSpacerLeft"></span>
    <span></span>
    <a href="javascript:downloadSummaryPDF('M');"><span
    class="MenuButtonRight" id="cmd4Week"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" >4
    week Summary</span></a>
    <span class="MenuSpacerRight"></span>
    <a href="javascript:downloadSummaryPDF('F');"><span
    class="MenuButtonRight" id="cmd2Week"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" >2
    week Summary</span></a>
    <span class="MenuSpacerRight"></span>
    <a href="javascript:downloadSummaryPDF('W');"><span
    class="MenuButtonRight" id="cmd1Week"
    onmouseover="MenuButtonIn(this);" onmouseout="MenuButtonOut(this);" >1
    week Summary</span></a>
    <span class="MenuSpacerRight"></span>
    </td>
    </tr>
     
    mark4asp, Apr 2, 2007
    #1
    1. Advertising

  2. Re: <form runat="server"> automatically adds <div> tag to code containedwithin. Is there a way to stop that?

    mark4asp wrote:
    > <form runat="server"> automatically adds <div> tag to code contained
    > within. Is there a way to stop that?
    >
    > Mixing block-level elements with inline-level elements messes up the
    > HTML becasuse that is invalid for a strict implementation. <span> is
    > in-line-level and <div> is block-level. I don't want to mix up <span>
    > and <div>
    >
    > I'm using an <asp:Button> here because when it switches to the URL I
    > need to check that the user is in the correct role - their role
    > determines which page they go to. Perhaps there's a better way to do
    > that?, which allows me to avoid using a form and a postback here?


    You can't have inline elements directly inside the form tag, so you need
    that div tag.

    --
    Göran Andersson
    _____
    http://www.guffa.com
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Apr 3, 2007
    #2
    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. ddfsdf
    Replies:
    0
    Views:
    358
    ddfsdf
    Oct 11, 2005
  2. shruds
    Replies:
    1
    Views:
    821
    John C. Bollinger
    Jan 27, 2006
  3. André
    Replies:
    2
    Views:
    734
    André
    Jun 23, 2008
  4. M Wells
    Replies:
    0
    Views:
    141
    M Wells
    Oct 6, 2004
  5. visu
    Replies:
    4
    Views:
    301
Loading...

Share This Page