westdh
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_Cl ick(sender As Object, e As System.EventArgs)'.
========================== ========== ========== =========
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmailCompanyAtte ndees.ascx .vb" Inherits="DesktopModules_i 2Integrati on___Event s_controls _EmailComp anyAttende es" %>
<asp:Button ID="Button1" runat="server" EnableViewState="False" Text="Email event notices to registered attendees"
ValidationGroup="EventRegA ttendee" Width="312px" OnClick="EmailRegAttendeeN otices_Cli ck()" />
========================== ========== ========== ========== ==
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_i2Integrati on___Event s_controls _EmailComp anyAttende es
Inherits System.Web.UI.UserControl
Protected Sub EmailRegAttendeeNotices_Cl ick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim u1 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a1 As Label = TryCast(u1.FindControl("lb lEventID") , Label)
Dim str1 As String
str1 = "Event ID: " + a1.Text + "<BR>"
Dim u2 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a2 As Label = TryCast(u2.FindControl("lb lStatus"), Label)
Dim str2 As String
str2 = "Event Status: " + a2.Text + "<BR>"
Dim u3 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a3 As Label = TryCast(u3.FindControl("lb lTitle"), Label)
Dim str3 As String
str3 = "Event Title: " + a3.Text + "<BR>"
Dim u4 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a4 As Label = TryCast(u4.FindControl("lb lDate"), Label)
Dim str4 As String
str4 = "Event Date: " + a4.Text + "<BR>"
Dim u5 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a5 As Label = TryCast(u5.FindControl("lb lSummary") , Label)
Dim str5 As String
str5 = "Event summary: " + a5.Text + "<BR>"
Dim u6 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a6 As Label = TryCast(u6.FindControl("lb lDetails") , Label)
Dim str6 As String
str6 = "Event details: " + a6.Text + "<BR>"
Dim u7 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a7 As Label = TryCast(u7.FindControl("lb lViewStart "), Label)
Dim str7 As String
str7 = "Event View Start Date: " + a7.Text + "<BR>"
Dim u8 As UserControl = TryCast(FindControl("Event Details"), UserControl)
Dim a8 As Label = TryCast(u8.FindControl("lb lViewEnd") , 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.GetGrdAttende es.Rows()
'sb.Append(ctlAttendees.gr dAttendees .DataKeys( dr.RowInde x)("strBad geName").T oString())
'sb.Append(",")
'Next
If sb.ToString() = "" Then
'Response.Write(sb.ToStrin g())
Dim msg As New MailMessage("dennis@dianew estdesign. com", "westdh@charter.net")
msg.Subject = str3 'txtEmailSubject.Value
msg.Body = Bodytext 'txtArea.Value
Dim sc As New SmtpClient("smtp.dianewest design.com ", 25)
sc.Credentials = New Net.NetworkCredential("den nis@dianew estdesign. 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
why am i getting this error ---
Argument not specified for parameter 'sender' of 'Protected Sub EmailRegAttendeeNotices_Cl
==========================
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="EmailCompanyAtte
<asp:Button ID="Button1" runat="server" EnableViewState="False" Text="Email event notices to registered attendees"
ValidationGroup="EventRegA
==========================
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.
Imports System.Web.UI.HtmlControls
Imports System.Net.Mail
Partial Class DesktopModules_i2Integrati
Inherits System.Web.UI.UserControl
Protected Sub EmailRegAttendeeNotices_Cl
Dim u1 As UserControl = TryCast(FindControl("Event
Dim a1 As Label = TryCast(u1.FindControl("lb
Dim str1 As String
str1 = "Event ID: " + a1.Text + "<BR>"
Dim u2 As UserControl = TryCast(FindControl("Event
Dim a2 As Label = TryCast(u2.FindControl("lb
Dim str2 As String
str2 = "Event Status: " + a2.Text + "<BR>"
Dim u3 As UserControl = TryCast(FindControl("Event
Dim a3 As Label = TryCast(u3.FindControl("lb
Dim str3 As String
str3 = "Event Title: " + a3.Text + "<BR>"
Dim u4 As UserControl = TryCast(FindControl("Event
Dim a4 As Label = TryCast(u4.FindControl("lb
Dim str4 As String
str4 = "Event Date: " + a4.Text + "<BR>"
Dim u5 As UserControl = TryCast(FindControl("Event
Dim a5 As Label = TryCast(u5.FindControl("lb
Dim str5 As String
str5 = "Event summary: " + a5.Text + "<BR>"
Dim u6 As UserControl = TryCast(FindControl("Event
Dim a6 As Label = TryCast(u6.FindControl("lb
Dim str6 As String
str6 = "Event details: " + a6.Text + "<BR>"
Dim u7 As UserControl = TryCast(FindControl("Event
Dim a7 As Label = TryCast(u7.FindControl("lb
Dim str7 As String
str7 = "Event View Start Date: " + a7.Text + "<BR>"
Dim u8 As UserControl = TryCast(FindControl("Event
Dim a8 As Label = TryCast(u8.FindControl("lb
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.GetGrdAttende
'sb.Append(ctlAttendees.gr
'sb.Append(",")
'Next
If sb.ToString() = "" Then
'Response.Write(sb.ToStrin
Dim msg As New MailMessage("dennis@dianew
msg.Subject = str3 'txtEmailSubject.Value
msg.Body = Bodytext 'txtArea.Value
Dim sc As New SmtpClient("smtp.dianewest
sc.Credentials = New Net.NetworkCredential("den
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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
ASKER
A critical error has occurred.
Object reference not set to an instance of an object.