We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

VS.NET Design View query

msiedle
msiedle asked
on
Medium Priority
300 Views
Last Modified: 2008-01-09
Hi all

We recently made a change to our page design and were required to add this to our ASP.NET to determine which css div tag was used:

                        <%
                        If Session("show_Right_Panel") = True Then
                        %>
                        <div id="main">
                        <%
                        Else
                        %>
                        <div id="main_wide">
                        <%
                        End If
                        %>

...which works great in the live environment, but in Visual Studio 2003 design view, it appears to be ignoring the If Else statement and just adding both div tags ...hence the design looks all screwed up

Eg. If I do this everything is fine:

                        <%
                        If Session("show_Right_Panel") = True Then
                        %>
                        <div id="main">
                        <%
                        End If
                        %>

...it just doesn't handle the Else ...hence my reason for thinking it is ignoring the If Else

Does anyone know a way to fix this, or get VS to see If Else statements and choose the div tag accordingly?

Thanks
Mark
Comment
Watch Question

You don't have any session variables in design time, so this can be difficult. You can determine whether you are in design time or not by checking the site variable which is nothing at runtime, but nonetheless: The design view cannot choose one div tag for you.

You could create a cutom control with your div tag and add a property to that control which determines which design to use. Only in this way you can get the design view to understand what youre doing

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.