VS.NET Design View query

Posted on 2006-04-03
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">
                        <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
                        %> 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?

Question by:msiedle
    1 Comment
    LVL 5

    Accepted Solution

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now