SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : Microsoft .NET :

Previous DiscussionNext Discussion
 ASPX Page Doesn't Display in Multiview

Using masterpages, multiview and menu controls.   A contentplaceholder is nested in each view.   When we load aspx pages into each view and try to switch between them we lose view or state of the others and can only see the last page loaded in its view.

Code snippets of master page aspx and code behind.

 

>>>MultiView ASPX Page:<<<
<!-- Begin Main Menu -->
  <table width="100%">
   <tr>
    <td align="left">     
     <asp:Menu ID="MenuMain"
          runat="server"
          BackColor="#00FFFF"
          DynamicHorizontalOffset="2"
          Font-Names="Verdana"
          Font-Size="Small"
          ForeColor="#000000"
          Orientation="Horizontal"               
          StaticSubMenuIndent="10px"
          AccessKey="M"
          onmenuitemclick="MenuMain_MenuItemClick">

      <StaticSelectedStyle BackColor="Cornsilk" ForeColor="black" Font-Bold="True" BorderStyle="Inset" BorderWidth="0px" BorderColor="Red" />              
      <StaticHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
      <StaticMenuItemStyle HorizontalPadding="10px" VerticalPadding="2px"/>       
    
      <DynamicMenuStyle BackColor="White" BorderStyle="Solid" BorderWidth="1px"/>
      <DynamicHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
      <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
    <Items>
      <asp:MenuItem Text="DIW" Value="0"/>
      <asp:MenuItem Text="OCS" Value="1"/>
      <asp:MenuItem Text="Safe Connect" Value="2"/>
    </Items>   
    </asp:Menu>
    </td>       
   </tr>
  </table>       
<!-- End Main Menu -->
<!-- Begin MultiView --> 
  <asp:MultiView
    id="MultiView1"
    Runat="server">
    <asp:View ID="vwDIW" runat="server" EnableViewState="true" EnableTheming="False">
    <table class="ICMMainMenuTable" width="100%">
      <tr>
      <td align="left">
        <asp:Menu
        id="mnuDIW"
        runat="server"
        BackColor="#e5e5e5"
        DynamicHorizontalOffset="2"
        Font-Names="Verdana"
        Font-Size="Small"
        ForeColor="#000000"
        Orientation="Horizontal"               
        StaticSubMenuIndent="10px"
        AccessKey="M">

      <StaticSelectedStyle BackColor="White" ForeColor="black" Font-Bold="True" BorderStyle="Inset" BorderWidth="1px" BorderColor="Red" />              
      <StaticHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
      <StaticMenuItemStyle HorizontalPadding="10px" VerticalPadding="2px"/>       
    
      <DynamicMenuStyle BackColor="White" BorderStyle="Solid" BorderWidth="1px"/>
      <DynamicHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
      <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
      </asp:Menu>
      </td>       
      </tr>
    </table>
    <h3>DIW VIEW</h3>       
       <asp:ContentPlaceHolder  id="ContentPlaceHolderDIW" runat="server">
        <!-- ! DIW CHILD PAGES CODE GOES HERE ! -->
      </asp:ContentPlaceHolder>
  </asp:View>
               
    <asp:View ID="vwOCS" runat="server" EnableViewState="true" EnableTheming="False">
    <table class="ICMMainMenuTable" width="100%">
      <tr>
      <td align="left">
        <asp:Menu
        id="mnuOCS"
          runat="server"
          BackColor="#e5e5e5"
          DynamicHorizontalOffset="2"
          Font-Names="Verdana"
          Font-Size="Small"
          ForeColor="#000000"
          Orientation="Horizontal"               
          StaticSubMenuIndent="10px"
          AccessKey="M">

        <StaticSelectedStyle BackColor="White" ForeColor="black" Font-Bold="True" BorderStyle="Inset" BorderWidth="1px" BorderColor="Red" />              
        <StaticHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
        <StaticMenuItemStyle HorizontalPadding="10px" VerticalPadding="2px"/>       
    
        <DynamicMenuStyle BackColor="White" BorderStyle="Solid" BorderWidth="1px"/>
        <DynamicHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
      </asp:Menu>
      </td>       
      </tr>
    </table>
    <h3>OCS VIEW</h3>            
      <asp:ContentPlaceHolder id="ContentPlaceHolderOCS" runat="server">
        <!-- ! OCS CHILD PAGES CODE GOES HERE ! -->
      </asp:ContentPlaceHolder>
    </asp:View>   

    <asp:View ID="vwSC" runat="server" EnableViewState="true" EnableTheming="False">
    <table class="ICMMainMenuTable" width="100%">
      <tr>
      <td align="left">
      <asp:Menu
        id="mnuSafeConnect"
            runat="server"
            BackColor="#e5e5e5"
            DynamicHorizontalOffset="2"
            Font-Names="Verdana"
            Font-Size="Small"
            ForeColor="#000000"
            Orientation="Horizontal"               
            StaticSubMenuIndent="10px" AccessKey="M">

        <StaticSelectedStyle BackColor="White" ForeColor="black" Font-Bold="True" BorderStyle="Inset" BorderWidth="1px" BorderColor="Red" />              
        <StaticHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
        <StaticMenuItemStyle HorizontalPadding="10px" VerticalPadding="2px"/>       
    
        <DynamicMenuStyle BackColor="White" BorderStyle="Solid" BorderWidth="1px"/>
        <DynamicHoverStyle BackColor="#e5e5e5" ForeColor="Black" Font-Underline="True" />
        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
      </asp:Menu>
     </td>       
     </tr>
    </table>
    <h3>Safe Connect VIEW</h3>
      <asp:ContentPlaceHolder id="ContentPlaceHolderSC" runat="server">
        <!-- ! SafeCon CHILD PAGES CODE GOES HERE ! -->
      </asp:ContentPlaceHolder>        
    </asp:View>  
  </asp:MultiView>
<!-- END MultiView --> 

>>>Code Behind:<<<
protected void MenuMain_MenuItemClick(object sender, MenuEventArgs e)
  {
  menuView = Int32.Parse(e.Item.Value);

  switch (menuView)
  {
  case (int)SystemType.DIW:
    MultiView1.ActiveViewIndex = menuView;
    break;
  case (int)SystemType.OCS:
    MultiView1.ActiveViewIndex = menuView;
    break;
  case (int)SystemType.SafeConnect:
    MultiView1.ActiveViewIndex = menuView;
    break;
  default:
    MultiView1.ActiveViewIndex = (int)SystemType.NotSet;
    break;
  }
  }
  protected void Page_Load(object sender, EventArgs e)
  {
  role = Convert.ToInt32(Session["Role"]);
  try
  {
    if (IsPostBack == false)
    {
    LoadMenusSafeConnect(role);
    LoadMenusDIW(3);
    LoadMenusOCS(3);

    MultiView1.ActiveViewIndex = Convert.ToInt32(SystemType.DIW); //default on load
    MenuMain.Items[MultiView1.ActiveViewIndex].Selected = true;
    }
   
    MultiView1.ActiveViewIndex = menuView;
    MenuMain.Items[menuView].Selected = true;
   }
  catch (Exception ex)
  {
    LogFile errWriter = (LogFile)Application["LoggerMgr"];
    errWriter.WriteErrorLog(ex);
    Server.Transfer("ErrorsDisplay.aspx?ErrMsg=" + ex.Message);
  }
  }

Started By thomasgow on May 4, 2012 at 2:15:12 PM

No Responses

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2004 InsideDHTML.com, LLC. All rights reserved.