Stopping VS.net from moving my IF statement...how!?!?!

D

Darrel

Ugh. I just spent an hour banging my head due to VS.net deciding to rewrite
my code. I have this:

<% if something %>
<object>
<% else %>
<object>
<% end if %>
<param />
</object>

But if I flip to design view and back, it rewrites it as such:

<% if something %>
<object>
<% else %>
<object>
<param />
</object>
<% end if %>

Anyway to get it to stop doing that!?

If not, I'm going to just repeat the entire object tag block, but since
there's 30+ parameter tags, it's going to get rather verbose.

-Darrel
 
K

Ken Dopierala Jr.

Hi Darrel,

It is probably trying to ensure you don't have any <object> tags without a
matching </object> tag. Since you have 1 closing </object> tag and two
possible opening <object> tags it is probably getting confused. Can you
show some actual code? Also, try using a code behind page instead, then you
can write whatever HTML you want in the Render events of the page and
objects. Good luck! Ken.
 
D

Darrel

It is probably trying to ensure you don't have any said:
matching </object> tag.

That's exactly what it's doing. Typical MS-knows-best-crap. Ugh.

I thought I had it fixed, but it's doing it again...

Here's the specific code:

<DIV><%
dim browserInfo as string = Request.Browser.Type
if Instr(lcase(browserInfo), "netscape") then
%>
<OBJECT id=editorLocation type=application/x-xstandard height=420 width=660
VIEWASTEXT>
<% else%>
<OBJECT id=editorLocation type=application/x-xstandard height=420 width=660
classid=clsid:0EED7206-1661-11D7-84A3-00606744831D VIEWASTEXT>
<%End If%>

<PARAM NAME="_Version" VALUE="65540"><PARAM NAME="_ExtentX" VALUE="17463">
(and then 40 other param tags or so...)

It's a text editor that I'm embedding on the page. The if is for a
rudimentary browser check. It needs to write out a different opening Object
tag depending on if it's Moz or IE.

I think I probably need to resort to your suggestion of generating it in the
codebehind. Argh. ;o)

-Darrel
 
D

Darrel

my code. I have this:
OK. Fixed it. If I response.write it all out:

<%
dim browserInfo as string = Request.Browser.Type
if Instr(lcase(browserInfo), "netscape") then

response.write("<OBJECT id=editorLocation type=application/x-xstandard
height=420 width=660 VIEWASTEXT>")
else
response.write("OBJECT id=editorLocation type=application/x-xstandard
height=420 width=660 classid=clsid:0EED7206-1661-11D7-84A3-00606744831D
VIEWASTEXT")

End If%>

then it works.

Whew. One less headache. ;o)
 
K

Ken Dopierala Jr.

Hi Darrel,

What happens if you do this:

<DIV>
<OBJECT id=editorLocation type=application/x-xstandard height=420 width=660
<%
dim browserInfo as string = Request.Browser.Type
if NOT Instr(lcase(browserInfo), "netscape") then
%>
classid=clsid:0EED7206-1661-11D7-84A3-00606744831D
<%End If%>
VIEWASTEXT>
<param/>
</object>

Don't know if that will work because I only use code behind. Don't forget
the NOT in your conditional. Good luck! Ken.
 
R

RC

<< Man VS.net can just piss you off sometimes>>>

That's why most of us don't use VS.net for html editing and instead use
VS.net only for the programming and a separate html editor for html editing.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,433
Messages
2,571,683
Members
48,796
Latest member
Greg L.

Latest Threads

Top