CSS TreeView and a Master Page (never meant to be?)

Last post 04-07-2007 7:43 AM by Russ Helfand. 5 replies.

Sort Posts:

  • CSS TreeView and a Master Page (never meant to be?)

    02-06-2007, 4:17 PM
    • Member
      2 point Member
    • dayodave
    • Member since 02-06-2007, 9:12 PM
    • Posts 2

    Here's hoping someone knows how to integrate the CSS Adapter for the TreeView and a Masterpage.  It seems like it would be the perfect marriage but I get errors each time I try.  Any ideas on how to get this working?

     Dave

     

  • Re: CSS TreeView and a Master Page (never meant to be?)

    02-11-2007, 12:50 PM
    • Contributor
      3,298 point Contributor
    • Russ Helfand
    • Member since 09-14-2005, 2:22 PM
    • Groovybits.com
    • Posts 741

    Hi Dave,

    Apologies for taking so long to respond to your post.  If you are still interested in digging into this, I'd like to help.

    Frankly, I'm not sure what the problem might be.  I need you to post more details. Perhaps you can provide the markup and code you are trying to use.  Also, it would help to see the exact error messages you are getting.

    I tried an experiment that seemed to show that the adapted TreeView can live on a simple master page.  Here is what I tried:

    1. After installing the CSS friendly adapter kit, I used VWD to create a new web site based on the kit's "ASP.NET CSS Friendly Web Site" template.
    2. In the Walkthrough folder I make a copy of SimpleTreeView.aspx and called that copy SimpleTreeView.master.
    3. In this new master file I changed the @Page directive to @Master. Then, just before the close of the FORM element I added a content placeholder that looked like this:

            <asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
            </asp:contentplaceholder>

    Now I created a new page within the Walkthrough folder and called it test.aspx.  Its content looks like this:

    <%@ Page Language="C#" MasterPageFile="~/WalkThru/SimpleTreeView.master" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    This is a test
    </asp:Content>

    When I run this page everything works as I would expect.  I see the TreeView from the master page and I see the "this is a test" text that was added through the content placeholder. I don't have any error messages or other problems.

    I realize that this is a pretty simple test.  Maybe it works because it is too simple! Still, it provides a good data-point to establish that fundamentally master pages and adapted TreeView instances are compatible at some basic level. Let's see how this differs from what you are trying to accomplish.

    Best regards,

    Russ Helfand
    Groovybits.com
  • Re: CSS TreeView and a Master Page (never meant to be?)

    04-05-2007, 6:33 PM
    • Member
      11 point Member
    • junglemason
    • Member since 03-21-2006, 3:00 AM
    • Posts 10

    I am also having a problem that sounds like the one Dave posted about.

    Placing a TreeView in a Master Page works just fine.

    When I place a TreeView (with CSS Friendly Adapters installed) within an asp:Content control, I get the following exception:
    The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

    I believe this has something to do with how the ViewState is set up at runtime.  Luckily for me, I don't need a ViewState for this particular control since I'm not using the expanding/collapsing feature, so I can just add EnableViewState="false" to the TreeView and it works fine.  But this won't work for many people.

    If anyone can solve the issue of it breaking with a ViewState, I look forward to the solution.

    Cheers,
    Rich

  • Re: CSS TreeView and a Master Page (never meant to be?)

    04-06-2007, 5:43 AM
    • Member
      8 point Member
    • Dmitry Karpenkov
    • Member since 04-04-2007, 10:29 AM
    • Belarus, Minsk
    • Posts 8

    I proposed solution for this problem in another thread some days ago.
    You can see it at http://forums.asp.net/thread/1488821.asp

  • Re: CSS TreeView and a Master Page (never meant to be?)

    04-06-2007, 5:46 AM
    • Member
      8 point Member
    • Dmitry Karpenkov
    • Member since 04-04-2007, 10:29 AM
    • Belarus, Minsk
    • Posts 8
  • Re: CSS TreeView and a Master Page (never meant to be?)

    04-07-2007, 7:43 AM
    • Contributor
      3,298 point Contributor
    • Russ Helfand
    • Member since 09-14-2005, 2:22 PM
    • Groovybits.com
    • Posts 741
    Both of the links that Dmitry posted earlier seem broken to me. I think that the posting he was alluding to (that may be a fix for the problem being discussed in this thread) may be this one http://forums.asp.net/thread/1488821.aspx. Dmitry had the text of the link right but the link itself left off the x so it was broken. Look for Dmitry's solution posted in the 1488821 thread on 04-04-2007, 5:36 AM.
    Russ Helfand
    Groovybits.com
Page 1 of 1 (6 items)