troubleshooting Question

Argument not specified for parameter 'e' of 'Public Sub BindData(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs)'.

Avatar of Nugs
Nugs asked on
ASP.NET
4 Comments1 Solution1972 ViewsLast Modified:
Man this one is annoying...

I am taking a lesson from the MSDN Library (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolsdatalistitemeventargsclasstopic.asp)

I have a checkbox in a datalist that I want to set the checked attribute to true or false depending on the data found in the database for that item.

Initially all I am trying to do here is get the damned checkbox on the page without errors... I am not even looking at the database yet to set the attribute... My problem is with the (sender As Object, e As DataListItemEventArgs) part of the code found on the MSDN page above...

Here is my code:

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Sub Page_Load(sender As Object, e As EventArgs)
      If NOT Page.IsPostback
            BindData()
      End If
End Sub

Sub BindData(sender As Object, e As DataListItemEventArgs)
      Dim oleConn As New OleDb.OleDbConnection(System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_TDGDBConn"))
      Dim oleComm AS NEW OleDb.oleDbCommand()
            oleComm.Connection=oleConn
            oleConn.Open()
      Dim DAChk As New OleDbDataAdapter("SELECT *  FROM TBL_Specials", oleConn )
      Dim DSChk As New DataSet()
            DAChk.Fill(DSChk)      
            
            Try
            If Request.QueryString("DelID") <> "" And CStr(DSChk.Tables(0).Rows.Count) > 8 Then            
                oleComm.CommandText = "DELETE From TBL_Specials Where ID=" & Request.QueryString("DelID")
                oleComm.ExecuteNonQuery()
                lblMsg.Text = "Special #" & Request.QueryString("delid") & " deleted!"
                        lblRecCount.Visible = "false"
            Else
                        lblRecCount.Text = "There need to be at least 8 specials. Please add more before you can delete any."             
                        lblRecCount.Visible = "true"
        End If
            If Request.QueryString("DelID") = "" Then
                  lblRecCount.Visible = "false"
            End If
            Catch ex As Exception
            lblMsg.Text = ex.Message
            End Try            

      Dim da as New OleDb.OleDbDataAdapter()
      Dim ds as New DataSet()
            da.selectCommand=Olecomm
      
            oleComm.CommandText="SELECT * FROM TBL_Specials  ORDER BY Fld_SailDate ASC"
            da.Fill(ds,"Specials")
            DL_Specials.datasource=ds.Tables("Specials")
            DL_Specials.DataBind()                  
            
            'chkNewsletter
            
            If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim chkNewsletter As CheckBox = CType(e.Item.FindControl("chkNewsletter"), CheckBox)

            Dim Price As String = "True"  
            chkNewsletter.Checked = Price

        End If            
      
            oleConn.Close()
End Sub
--------------------------------------------------------------------------------------------------------------------------------------------------------------


I get this error among others, all normally to do with the e declaration:

--------------------------------------------------------------------------------------------------------------------------------------------------------------
Compiler Error Message: BC30455: Argument not specified for parameter 'e' of 'Public Sub BindData(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs)'.

Source Error:


Line 19:       If NOT Page.IsPostback
Line 20:             CleanData()
Line 21:             BindData()
Line 22:       End If
Line 23: End Sub


I think I do not understand the (sender As Object, e As EventArgs) and (sender As Object, e As DataListItemEventArgs) parts of the page…

I need some help here bad…

Nugs
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros