Results 1 to 2 of 2

Thread: css button

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2007
    Posts
    308

    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

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width