using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DateTime dt = Convert.ToDateTime(Session["dete"]);
Page.Master.EnableViewState = true;
lblForumName.Text = Convert.ToString(dt);
lblLatest.Text = Convert.ToString(Session["Forum"]);
}
Main.master(Menus .Visibles set to false)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DateTime dt = Convert.ToDateTime(Session["dete"]);
Page.Master.EnableViewState = true;
lblForumName.Text = Convert.ToString(dt);
lblLatest.Text = Convert.ToString(Session["Forum"]);
}
As pointed out by others, you’re doing a redirect to another page after setting the menu to visible. This will revert the menu’s Visible property to its original state. So if you set its Visible to false in the markup, it will remain invisible. The workflow
is:
Calendar1_SelectionChanged1 is invoked
You set menu’s Visible to true
You do a redirect
The markup of your master page is parsed
In the markup, you set menu’s Visible to false
In the end, the menu is invisible.
I would like to suggest you to put the code setting menu’s Visible in OnLoad on the second page instead of the SelectionChanged event handler. That essentially adds another step to the above workflow:
In OnLoad of the second page, you set the menu’s Visible to true
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
I took out the "override" out of the OnLoad event signature and now the menus dont show up but I have access to my session variables so I'm going to have to say yes they are available.
To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the
problem. You can remove any confidential information or business logic from it. Then we can find the issue more conveniently and provide further suggestions for you.
I would recommend that you can use
Windows Live SkyDrive to share the sample project.
Best Regards,
Ming Xu.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 01, 2012 10:33 PM|LINK
Default.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DateTime dt = Convert.ToDateTime(Session["dete"]); Page.Master.EnableViewState = true; lblForumName.Text = Convert.ToString(dt); lblLatest.Text = Convert.ToString(Session["Forum"]); }Main.master(Menus .Visibles set to false)
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DateTime dt = Convert.ToDateTime(Session["dete"]); Page.Master.EnableViewState = true; lblForumName.Text = Convert.ToString(dt); lblLatest.Text = Convert.ToString(Session["Forum"]); }Default.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> <style type="text/css"> .style4 { height: 31px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <table class="style1"> <tr> <td width="17%" class="style4"> </td> <td class="style4"> </td> <td width="17%" class="style4"> </td> </tr> <tr> <td> </td> <td> <table class="style1"> <tr> <td width="60%"> <asp:Label ID="lblForumName" runat="server" Font-Size="X-Large"></asp:Label> </td> <td width="40%"> <asp:Label ID="lblLatest" runat="server" Font-Size="Larger">Latest</asp:Label> </td> </tr> <tr> <td class="style2"> </td> <td class="style2"> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> </td> <td> </td> </tr> </table> </asp:Content>Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 01, 2012 10:34 PM|LINK
Yes I can see it.
Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 02, 2012 12:49 AM|LINK
But the menus just wont show up.
Ming Xu - MS...
All-Star
25269 Points
2235 Posts
Microsoft
Re: Masterpage to Default
May 02, 2012 08:46 AM|LINK
Hi,
As pointed out by others, you’re doing a redirect to another page after setting the menu to visible. This will revert the menu’s Visible property to its original state. So if you set its Visible to false in the markup, it will remain invisible. The workflow is:
Calendar1_SelectionChanged1 is invoked
You set menu’s Visible to true
You do a redirect
The markup of your master page is parsed
In the markup, you set menu’s Visible to false
In the end, the menu is invisible.
I would like to suggest you to put the code setting menu’s Visible in OnLoad on the second page instead of the SelectionChanged event handler. That essentially adds another step to the above workflow:
In OnLoad of the second page, you set the menu’s Visible to true
Best Regards,
Ming Xu.
Feedback to us
Develop and promote your apps in Windows Store
Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 02, 2012 06:48 PM|LINK
I did what you suggested but now I dont see my labels displaying my session variables. The menus appear though. All I did was change the Default.cs to
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.SqlClient; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { DateTime dt = Convert.ToDateTime(Session["dete"]); Page.Master.EnableViewState = true; lblForumName.Text = Convert.ToString(dt); lblLatest.Text = Convert.ToString(Session["Forum"]); } protected override void OnLoad(EventArgs e) { Menu lMenu = (Menu)Master.FindControl("MnuLeft"); Menu rMenu = (Menu)Master.FindControl("MnuRight"); if (lMenu.Visible == false && rMenu.Visible == false && Session["dete"] != null) { lMenu.Visible = true; rMenu.Visible = true; } }Ming Xu - MS...
All-Star
25269 Points
2235 Posts
Microsoft
Re: Masterpage to Default
May 03, 2012 07:15 AM|LINK
Hi,
When you debug into the code, do you see the session data are available?
Best Regards,
Ming Xu.
Feedback to us
Develop and promote your apps in Windows Store
Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 03, 2012 06:51 PM|LINK
I took out the "override" out of the OnLoad event signature and now the menus dont show up but I have access to my session variables so I'm going to have to say yes they are available.
Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 03, 2012 07:54 PM|LINK
What am I missing? Please help.
Code_warrior...
Member
251 Points
282 Posts
Re: Masterpage to Default
May 05, 2012 09:10 PM|LINK
Boy do I miss the good old days of asp.net.
Ming Xu - MS...
All-Star
25269 Points
2235 Posts
Microsoft
Re: Masterpage to Default
May 07, 2012 02:46 AM|LINK
Hi,
To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it. Then we can find the issue more conveniently and provide further suggestions for you.
I would recommend that you can use Windows Live SkyDrive to share the sample project.
Best Regards,
Ming Xu.
Feedback to us
Develop and promote your apps in Windows Store