'How to hide login button when user logged in show logout button in asp.net vb?
Protected Sub btnloginp1_Click(sender As Object, e As EventArgs) Handles btnloginp1.Click
If logemail.Text = "" Or logpassw.Text = "" Then
lbl_msg_log.Text = "Enter Email address and Password"
Else
lbl_msg_signup.Text = ""
Dim conn As New SqlConnection
Dim constr As String
constr = "Data Source=LAPTOP-CAK7UT2M;Initial Catalog=MyProjectUService;Integrated Security=True"
conn.ConnectionString = constr
conn.Open()
Dim sql = "select * from Login where login_email='" & logemail.Text & "' and login_password='" & logpassw.Text & "'"
Dim comm As New SqlCommand(sql, conn)
Dim dr As SqlDataReader
dr = comm.ExecuteReader
Dim a
If dr.Read() = True Then
a = 1
Else
a = 0
End If
dr.Close()
conn.Close()
btn_login.visible=false
Dim btnn As New Button
//above is login button which i want to hide when user successful logged and show below signout button
btnn.Text = "SignOut"
plhadd.Controls.Add(btnn)
End If
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
