Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > <form runat="server"> automatically adds <div> tag to code contained within. Is there a way to stop that?

Reply
Thread Tools

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

 
 
mark4asp
Guest
Posts: n/a
 
      04-02-2007
<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>

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      04-03-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there anyway I can use a static function contained in a class froman object. Jim C++ 2 10-16-2009 07:51 AM
error "A form tag with runat=server must exist" but there is a form tag!! André ASP .Net 2 06-23-2008 07:49 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
c# webapp template - how to custom a template so it automatically adds files within directories? ddfsdf ASP .Net 0 10-11-2005 02:47 PM
stop VS.NET 2003 IDE automatically insert <font> tag Darren Li ASP .Net 3 04-25-2005 06:39 PM



Advertisments