master page refresh

G

Ganesh

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

Thanks
Ganapathi
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

Have you tried setting the button visibility from the Master Page's Load
event?
If not, that's what I would suggest.
 
M

Mark Rae [MVP]

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
}
 
G

Guest

Hi,

I don't know how complex your soulution is but did you think about using
LoginView control?

Regards,
Ladislav
 
G

Ganesh

Hi,

I don't know how complex your soulution is but did you think about using
LoginView control?

Regards,
Ladislav







- Show quoted text -

Hi Thanks for your email, I don't use any login controls from
microsoft, I think it's not user friendly and needs another database
to store all the user information. I want to have userinformation in a
table with some more additional information which is not available in
the login controls.


I change the master control visibility from details page, i'll try
with master page load
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top