•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 456,521 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,802 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 684 | Replies: 3
![]() |
•
•
Join Date: Sep 2007
Posts: 69
Reputation:
Rep Power: 0
Solved Threads: 0
Here is my work. i just want to put 2 button link that is 1 for sign in and the other for Register.
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub btnSignIn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSignIn.Click
If txtUserName.Text = "geeta" And txtPassword.Text = "geetajlo" Then
MsgBox("Welcome geetajlo")
btnSignIn.Visible = False
HyperLink1.Visible = True
Else
MsgBox("Wrong UserName or Password")
End If
End Sub
End Class
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub btnSignIn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSignIn.Click
If txtUserName.Text = "geeta" And txtPassword.Text = "geetajlo" Then
MsgBox("Welcome geetajlo")
btnSignIn.Visible = False
HyperLink1.Visible = True
Else
MsgBox("Wrong UserName or Password")
End If
End Sub
End Class
•
•
Join Date: Sep 2007
Posts: 1,058
Reputation:
Rep Power: 4
Solved Threads: 61
Where is the second button? Is the register button HyperLink1? Anyway, I would suggest something similar to below:
'Add two buttons to your page, call them btnSignIn and btnRegister.
'Assuming you are doing this on Page_Load, use a session variable to hold someone's login status:
Sub Page_Load
If Session("signedIn") = "True" then
btnSignIn.Visible = false
btnRegister.Visible = false
'hyperlinkRegister.Visible = false
HyperLink1.Visible = true
'do whatever you need to here for protected page.
else
btnSignIn.Visible = true
'If you are partial to the button, use the function below. If not, use a hyperlink.
'hyperlinkRegister.Visible = true
'hyperlinkRegister.Text = "Register"
'hyperlinkRegister.NavigateUrl = "register.aspx"
btnRegister.Visible = true
'Still don't know what hyperlink1 is for :)
HyperLink1.Visible = false
'do whatever you need to here to protect the page.
end if
End Sub
Sub btnSignIn_Click(S As Object, E As EventArgs) Handles btnSignIn.Click
If txtUserName.Text = "geeta" And txtPassword.Text = "geetajlo" Then
Session("signedIn") = "True"
MsgBox("Welcome geetajlo")
btnSignIn.Visible = False
btnRegister.Visible = False
HyperLink1.Visible = True
Else
MsgBox("Wrong UserName or Password. Please Try Again.")
End If
End Sub
Sub btnSignOut_Click(S As Object, E As EventArgs) Handles btnSingOut.Click
Session("signedIn") = ""
'If you have a page below or if you need redirection..
response.redirect ("logout.aspx?logout=successful")
End Sub
Sub btnRegister_Click(S As Object, E As EventArgs) Handles btnRegister.Click
response.redirect = "register.aspx"
End Sub![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Page Shadow, Help Needed! (HTML and CSS)
- Can I use a template html page within another html page (Site Layout and Usability)
- Align floated images in center of page with CSS (HTML and CSS)
- PHP problem - register page (PHP)
- Need help for webpage!! (Promotion and Marketing Plans)
- Flash/Javascript/HTML code for gallery page (Web Development Job Offers)
- PHP in a html page? (PHP)
- Grab info from vB and put into HTML page (Growing an Online Community)
Other Threads in the ASP.NET Forum
- Previous Thread: App_Data
- Next Thread: How to put procedures in a dynamic input button?



Linear Mode