By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,930 Members | 1,517 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,930 IT Pros & Developers. It's quick & easy.

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

P: n/a
<form runat="server"automatically adds <divtag 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. <spanis
in-line-level and <divis block-level. I don't want to mix up <span>
and <div>

I'm using an <asp:Buttonhere 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 <spanand 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>

Apr 2 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
mark4asp wrote:
<form runat="server"automatically adds <divtag 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. <spanis
in-line-level and <divis block-level. I don't want to mix up <span>
and <div>

I'm using an <asp:Buttonhere 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
Apr 3 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.