VS.NET removes my code

VS.NET removes my code

Post by J Leonar » Fri, 25 Apr 2003 02:17:28



I have the following code in my aspx page.

<% If StuffFromDatabase = "yes" then
      myTop = 100
   Else
      myTop = 200
%>
<div style="position:absolute; top:<%=myTop%>">Test</div>

If I save/rebuild this page it works fine.

However, if I switch between DESIGN / HMTL a couple of
time, VS changes my code to

<% If StuffFromDatabase = "yes" then
      myTop = 100
   Else
      myTop = 200
%>
<div>Test</div>

It removes my entire absolute positing sytle!

PS. Sorry about double posting. I did not know there were  
a VS and a VS .NET newsgroup.

 
 
 

VS.NET removes my code

Post by Gregory A. Beame » Sun, 27 Apr 2003 03:29:43


I would thrown in a panel (which becomes a DIV) and dynamically change the
style in codeBehind. You can also place the Page_Load (or other events) in
the page in a script block and accomplish the same thing. Push works better
with settings than pull.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

****************************************************************************
****
Think Outside the Box!
****************************************************************************
****

Quote:> I have the following code in my aspx page.

> <% If StuffFromDatabase = "yes" then
>       myTop = 100
>    Else
>       myTop = 200
> %>
> <div style="position:absolute; top:<%=myTop%>">Test</div>

> If I save/rebuild this page it works fine.

> However, if I switch between DESIGN / HMTL a couple of
> time, VS changes my code to

> <% If StuffFromDatabase = "yes" then
>       myTop = 100
>    Else
>       myTop = 200
> %>
> <div>Test</div>

> It removes my entire absolute positing sytle!

> PS. Sorry about double posting. I did not know there were
> a VS and a VS .NET newsgroup.