Hi Dw

I'm creating a web app for my future use and now I'm having a problem in calling a button to enable it. The web app start with Default.aspx and that where a user had to fill in 3 text boxs and click a button. So I've removed the default menu buttons and now I've added 5 buttons on a Site.Master page so that the buttons will be visible to all pages so the problem start here because I don't want the Default.aspx page to have these buttons because a user has to confirm first so there should be just one button on a Default button which is named "I ACCEPT TERMS OF USE" which I've added straight to the Default.aspx page, I've decide to use the Session() so that I can try to track if the user has confirmed or not, I've added the Session("d") = TextBox3.Text

"d" is for date which is calculated from the info entered by the user. So if the user is over 18 years which is Uryear = TextBox3.Text - Year(Now)
So if the user is over 18 then I record the session with the total or the age of the user in a negative form (-00) so on the Master page I've added the code to check if the session("d") has something or not and if its empty then I hide the 5 buttons which named by default from Button1 to Button5 which are on the master page and it seems as if this is the only place I can call them in cades other pages like home.aspx does not recognize them but on execution they are shown to all pages. So now the problem is that after the session has been recorded it seems as if the Master page only load once because in my codes I've checked as follows:

If Session("d") = Nothing Then
Button1.Visible = False
Button2.Visible = False
Button3.Visible = False
Button4.Visible = False
Button5.Visible = False
Else
Button1.Visible = True
Button2.Visible = True
Button3.Visible = True
Button4.Visible = True
Button5.Visible = True
End If

So now it do hide the buttons up on execution/debuging but on the Default.aspx after I've recorded the Session() it does not set the Visibility of the buttons.
How can I solve this problem, any idea or perhaps recommendation will be appreciated.

Thanks

Sorry for not formatting the codes I'm using a Mobile phone.

Yes I've traced the Session and what it does is save the age and I've referred to it earlier before I even face this problem and it was giving me the correct age. I tried adding another master page but I removed it because I didn't want to get too confused because I had to keep a session because if the session is nothing then the user is transferred to a page where the session will be generated. Thanks for the like but now how can I write this: Button1.Visible = True using the FindControl on the link you provided?

Thanks again.

The problem is that the master page only loads once so even you load another page but the master page will not load again so I need maybe a way to reload the master page when changing the pages or perhaps refresh it so that it will re-execute the Form_Load() codes then I'm pretty sure it will do what I want it to do.

im pretty sure the master page reloads every time in asp.net, unless you are using ajax for your content.

For now, focus on proof of concept. Instead of getting the page to do what you want, get it to do the most basic of actions, in this case, display a variable session on the masterpage load.

Try that and come back with some code :)

Thanks to everyone who tried helping me in this problem. I've just solved this problem. On the Master page I added the If Session("d") isNot Nothing line of code under the Else and it solved the problem.

This question has already been answered. Start a new discussion instead.