I have a big problem i want to put 2 buttonlink in one page. Can we make it friends...
I have sent a sample just help me friends. Thanks

Recommended Answers

All 3 Replies

archive doesn't work. Anyway, you should be able to add the two separate buttons. Just make each button call a function isntead of letting them choose what to call. Please post your code using the [ code ] brackets and we can help further.

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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.