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:<<<
| BackColor="#00FFFF" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Small" ForeColor="#000000" Orientation="Horizontal" StaticSubMenuIndent="10px" AccessKey="M" onmenuitemclick="MenuMain_MenuItemClick"> |
Runat="server">
runat="server" BackColor="#e5e5e5" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Small" ForeColor="#000000" Orientation="Horizontal" StaticSubMenuIndent="10px" AccessKey="M"> |
DIW VIEW
runat="server" BackColor="#e5e5e5" DynamicHorizontalOffset="2" Font-Names="Verdana" Font-Size="Small" ForeColor="#000000" Orientation="Horizontal" StaticSubMenuIndent="10px" AccessKey="M"> |
OCS VIEW
runat="server"
BackColor="#e5e5e5"
DynamicHorizontalOffset="2"
Font-Names="Verdana"
Font-Size="Small"
ForeColor="#000000"
Orientation="Horizontal"
StaticSubMenuIndent="10px" AccessKey="M">
Safe Connect VIEW
>>>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);
}
}
v
tom gowPosted May 9, 2012, 3:35 PM
Kunal VaishyaPosted May 8, 2012, 12:33 AM
MultiView1.ActiveViewIndex = menuView
is zero or not
If MultiView1.ActiveViewIndex = 0
Means MultiView1 will not display any view