VS2008 Design view doesn't like LoginView!!!

Discussion in 'ASP .Net' started by dan, Feb 14, 2008.

  1. dan

    dan Guest

    It appears that if you have a ContentPlaceHolder within a LoginView
    control on a masterpage that you will not be able to use the design
    feature in VS2008.

    To reproduce the problem simply place a LoginView control on a master
    page and place the ContentPlaceHolder within the LoggedInTemplate.

    Make another page using the master page you just created. In design
    view none of the changes to this page will be visible. I assume this
    is because we are not logged in. Although it is possible to change
    the view on the master page to view the LoggedInTemplate I have not
    found a way to view the LoggedInTemplate on the page using the

    Is there a work around?
    dan, Feb 14, 2008
    1. Advertisements

  2. The design of the logged in view is to show content based on conditions. The
    norm is logged in/not logged in. It is designed to show either one template
    or the other.

    You can use it in a master page. You can also use it in a page. The pattern,
    in general, is use it in a page if you need content for a single page, use
    in a master page if you want content for all pages.

    You would like to set it on a master page (all pages) and have it act like
    it is on a page (single page), correct?

    I view that as an anti-pattern. And, the reason it blows chunks is very
    simple. The master page is actually a user control, when you look at it
    underneath the hood. You are now placing controls, controlled by the page,
    inside a master page control, which is controlled by the page. I know it
    does not look like that, when you design, but that is what is happening when
    it renders. In effect, you are creating an endless recusion loop in design
    view, or at least potentially.

    While it is a pain, the more correct manner is to place a Content region
    where you want the LoginView and then set it up on each page. It is really
    not much work, as you are placing a control on the master and then another
    on the page in each instance. It is a bit different way of thinking about
    it, however.

    I know you may not like this answer, but the other option is to shoot blind
    and hope the rendering engine for .NET always renders without recursing too
    far and ending up in the same death spiral as Visual Studio.
    Cowboy \(Gregory A. Beamer\), Feb 14, 2008
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.