"Ganesh" <gs******@yahoo.comwrote in message
news:uR**************@TK2MSFTNGP05.phx.gbl...
I've couple of button on master page, based on user login from
default.aspx i control visibility of controls. I thought once i hide the
button from default.aspx it should be same for other pages aswell. but it
doesn't. it works only for default.aspx only.
How can i do that? do i need refresh master page or call my condition in
every page to setup master's button visiblity
Presumably once the user has logged on, then the visibility of the buttons
remains the same for the entire duration of the session?
If so, store a boolean Session variable and point your MasterPage at it e.g.
Global.asax.cs
---------------
void Session_Start(Object sender, EventArgs e)
{
Session["MyLoginVariable"] = false | true; // initial value, as
required
}
default.master.cs
-----------------
protected void Page_Load(object sender, EventArgs e)
{
MyButton.Visible = (bool)Session["MyLoginVariable"];
}
default.aspx.cs
---------------
protected void cmdLogin_Click(object sender, EventArgs e)
{
Session["MyLoginVariable"] = true | false; // depending on result of
login
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net