-
css button
Hey guys I am having a problem with a css button. I have used a css button that i got off the net and I am calling a public sub on the onclick function here is the code
HTML Code:
<div style="padding-left:22px;">
<a class="button" href="#" onclick="<%# check() %>">
<span><span><span><span>Confirm Order's</span></span></span></span>
</a>
</div>
Here is the <% check() %> code
Code:
Public Sub check()
Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\StonemansGardenCentre.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
Dim SSQL As String
SSQL = "Select * From user_tbl Where UserName = '" & textbox1.Value & "' and Password = '" & textbox2.Value & "'"
Dim command As New SqlCommand(SSQL, cn)
Dim table As New DataTable
Dim adapter As New SqlDataAdapter
adapter.SelectCommand = command
adapter.Fill(table)
If table.Rows.Count > 0 Then
textbox1.Value = ""
textbox2.Value = ""
Session("UserName") = table.Rows(0)("UserName")
Session("LoggedIn") = "1"
Session("Priviliges") = table.Rows(0)("Priviliges")
Response.Redirect("Home.aspx")
Else
wrong.Visible = True
textbox1.Value = ""
textbox2.Value = ""
End If
End Sub
Now here is the error I am getting. Can anyone help?
Overload resolution failed because no accessible 'ToString' can be called with these arguments:
it has highlighted the
<a class="button" href="#" onclick="<%# check() %>">
part.
Thanks for any help in advance
-
Re: css button
Change the declaration to:
Code:
<a class="button" href="#" onclick="check" runat="server">
And modify your method signature to:
Code:
Public Sub check(sender As Object, e As EventArgs)
Out of interest, the code is subject to SQL injection attacks . May want to look at session hijacking as well :)