I am getting this error for my button but it is already assigned in the code behind not sure why it is getting it?
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'Button1_Click' is not a member of 'ASP.register_aspx'.
Source Error:
Line 191: <tr>
Line 192: <td colspan="3">
Line 193: <asp:Button ID="Button1" runat="server" Text="Submit" onClick="Button1_Click"/>
Line 194: </td>
Line 195: </tr>
At the top of this file, is it referencing the correct code-behind (with correct namespace)? I’d see stuff like this sometimes when copy/pasting files and forgetting to update the references within.
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/main.Master" CodeBehind="register.aspx.vb" Inherits="IOG.Contact" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title>IOG Products, LLC</title>
<meta name="description" content="IOG products are used throughout the production process and during the journey to the ultimate end-user. By attaching our monitors to your shipment it enables you to take more control of your product during transit and helps to reduce your risk by keeping track of them every step of the way. " />
<meta name="keywords" content="IOG Products, transporation monitoring systems, omni-g, impact recorder m series, impact recorder, protect-a-pak, single use tilt indicator, tilt indicator, digital impact recorder, data recorder, single use shock recorder, impact-o-graph, IOG" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
Here is the code behind. its called register.aspx.vb
Imports System.Net.Mail
Public Class register
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs)
Try
Dim mailMessage As New MailMessage()
mailMessage.From = New MailAddress("")
mailMessage.[To].Add("")
mailMessage.Subject = txtSubject.Text
mailMessage.Body = "<b>Sender Name : </b>" + txtname.Text + "<br/>" + "<b>Sender Email : </b>" + txtEmail.Text + "<br/>" + "<b>Comments : </b>" + txtComments.Text
mailMessage.IsBodyHtml = True
Dim smtpClient As New SmtpClient("smtpout.secureserver.net ", 465)
smtpClient.EnableSsl = True
smtpClient.Credentials = New System.Net.NetworkCredential("csosa777@gmail.com", "sosa75722")
smtpClient.Send(mailMessage)
Label1.Text = "Thank for contacting us"
Label1.ForeColor = System.Drawing.Color.Blue
txtname.Enabled = False
txtEmail.Enabled = False
txtComments.Enabled = False
txtSubject.Enabled = False
Button1.Enabled = False
Catch generatedExceptionName As Exception
' Log - Event Viewer or table
Label1.ForeColor = System.Drawing.Color.Blue
Label1.ForeColor = System.Drawing.Color.Red
Label1.Text = "There is an unknown problem. Please try later"
End Try
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Protected Sub ddlCountries_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
End Class
'=======================================================
'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik
'Facebook: facebook.com/telerik
'=======================================================