
Originally Posted by
blakemckenna
mendhak,
Then how would I could the statement in post #26? Basically, when the user clicks on a button (if he is not logged in), a message needs to popup letting them know they are not allowed to access that link.
The way I've thought it out is to set a boolean variable to true if a member of the site has logged in. When a menu button is clicked, a check needs to be made against the boolean variable. How would I do this using that statement in post #26?
Thanks,
There are many other ways to do this like using the ClientScript.RegisterStartupScript etc. to insert the javascript code, but this is just the basic way to do this (in continuation of post #26):
Just give your form body element an ID and add the runat="server" tag to it, so that we can refer to it in code-behind.
Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
...
</head>
<body runat="server" ID="PageBody">
...
</body>
</html>
Then the rest of it is similar to what I posted in post #26
vb.net Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsLoggedIn Then '' replace with whatever way you use to authenticate the user.
PageBody.Attributes("onload") = "javascript:alert('User is not logged in!');return false;"
End If
End Sub