Link to home
Start Free TrialLog in
Avatar of westdh
westdhFlag for United States of America

asked on

Argument not specified for parameter 'sender' of 'Protected Sub EmailRegAttendeeNotices_Click(sender As Object, e As System.EventArgs)'.

I have list both the control frontpage and code behind -

why am i getting this error ---

Argument not specified for parameter 'sender' of 'Protected Sub EmailRegAttendeeNotices_Click(sender As Object, e As System.EventArgs)'.

=======================================================

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmailCompanyAttendees.ascx.vb" Inherits="DesktopModules_i2Integration___Events_controls_EmailCompanyAttendees" %>

 <asp:Button ID="Button1" runat="server"  EnableViewState="False" Text="Email event notices to registered attendees"
        ValidationGroup="EventRegAttendee" Width="312px" OnClick="EmailRegAttendeeNotices_Click()" />

==========================================================

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Collections
Imports System.IO
Imports System.Text
Imports System.Xml
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Net.Mail

Partial Class DesktopModules_i2Integration___Events_controls_EmailCompanyAttendees
    Inherits System.Web.UI.UserControl

    Protected Sub EmailRegAttendeeNotices_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim u1 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a1 As Label = TryCast(u1.FindControl("lblEventID"), Label)
        Dim str1 As String
        str1 = "Event ID: " + a1.Text + "<BR>"

        Dim u2 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a2 As Label = TryCast(u2.FindControl("lblStatus"), Label)
        Dim str2 As String
        str2 = "Event Status: " + a2.Text + "<BR>"

        Dim u3 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a3 As Label = TryCast(u3.FindControl("lblTitle"), Label)
        Dim str3 As String
        str3 = "Event Title: " + a3.Text + "<BR>"

        Dim u4 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a4 As Label = TryCast(u4.FindControl("lblDate"), Label)
        Dim str4 As String
        str4 = "Event Date: " + a4.Text + "<BR>"

        Dim u5 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a5 As Label = TryCast(u5.FindControl("lblSummary"), Label)
        Dim str5 As String
        str5 = "Event summary: " + a5.Text + "<BR>"

        Dim u6 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a6 As Label = TryCast(u6.FindControl("lblDetails"), Label)
        Dim str6 As String
        str6 = "Event details: " + a6.Text + "<BR>"

        Dim u7 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a7 As Label = TryCast(u7.FindControl("lblViewStart"), Label)
        Dim str7 As String
        str7 = "Event View Start Date: " + a7.Text + "<BR>"

        Dim u8 As UserControl = TryCast(FindControl("EventDetails"), UserControl)
        Dim a8 As Label = TryCast(u8.FindControl("lblViewEnd"), Label)
        Dim str8 As String
        str8 = "Event View End Date: " + a8.Text + "<BR>"

        Dim Bodytext As String = str1 + str2 + str3 + str4 + str6 + str7 + str8
        'If str <> "" Then
        'Response.Write("Found lblTitle" + Str())
        'End If

        Dim sb As New StringBuilder()
        'For Each dr As DataRow In ctlAttendees.GetGrdAttendees.Rows()
        'sb.Append(ctlAttendees.grdAttendees.DataKeys(dr.RowIndex)("strBadgeName").ToString())
        'sb.Append(",")
        'Next

        If sb.ToString() = "" Then
            'Response.Write(sb.ToString())
            Dim msg As New MailMessage("dennis@dianewestdesign.com", "westdh@charter.net")
            msg.Subject = str3  'txtEmailSubject.Value
            msg.Body = Bodytext 'txtArea.Value

            Dim sc As New SmtpClient("smtp.dianewestdesign.com", 25)
            sc.Credentials = New Net.NetworkCredential("dennis@dianewestdesign.com", "programmer")
            sc.EnableSsl = False
            Try
                sc.Send(msg)
                Response.Write("<B>Email Has been sent successfully.</B>")
            Catch ex As Exception
                Response.Write(ex.Message)
            End Try
        End If

    End Sub
End Class
ASKER CERTIFIED SOLUTION
Avatar of danirk2
danirk2

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of westdh

ASKER

Now I am getting this

A critical error has occurred.
Object reference not set to an instance of an object.
Avatar of ullfindsmit
Suggestion 1:
Change AutoEventWireup="false" to AutoEventWireup="true"

Suggestion 2:
Implement the INamingContainer

This will make sure that if you have the same control multiple times on a page, all BUTTONS and LABELS in the control dont get repeated twice.
at which point are u getting this error