Help For Newbie Please


B

bgreer5050

I know I am missing something simple. Can someone help me identify
it? I am getting the following error:



*****************Error*********************************************

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: 'btnSubmit_Click' is not a member of
'ASP.emailforms_aspx'.

Source Error:



Line 67: <p align="center">
Line 68:
Line 69: <asp:Button Runat = server ID = btnSubmit OnClick =
btnSubmit_Click Text = "Submit"></asp:Button>
Line 70: &nbsp;<input id="Reset1" type = "reset" runat = "server"
value = "Clear"></td>
Line 71: </tr>


****************The Entire Page**********************************




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="left">
<table> border="0" width="544"
<tr>
<td valign="top"><font face="Verdana" size="2">Name</font></td>
<td height="24" valign="top"> <asp:TextBox runat="server"
Height="25px" Width="370px" ID="txtName"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqName"
ControlToValidate="txtName" runat="Server" ErrorMessage="*"></
asp:RequiredFieldValidator></td>
</tr>
<tr>
<td valign="top"><font size="2" face="Verdana">Address</font></td>
<td height="24" valign="top">
<asp:TextBox runat="Server" Height="25px" Width="370px"
ID="txtAddress"></asp:TextBox></td>
</tr>
<tr>
<td valign="top"><font face="Verdana" size="2">From</font></td>
<td height="24" valign="top"> <asp:TextBox runat="server"
Height="22px" Width="368px"
ID="txtFrom"></asp:TextBox>
<asp:RequiredFieldValidator ID = "reqFrom1" ControlToValidate =
"txtFrom" runat = "server" ErrorMessage =
"*" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID = "regFrom2" ControlToValidate
= "txtFrom" runat = "server"
ErrorMessage = "Invalid Email" ValidationExpression="\w+([-+.]\w
+)*@\w+([-.]\w+)*\.\w+([-.]
\w+)*"></asp:RegularExpressionValidator>
<br></td>

</tr>

<tr>

<td valign="top"><font face="Verdana" size="2">To</font></td>

<td height="24" valign="top">

<asp:TextBox runat="server" Height="22px" Width="368px" ID="txtTo"></
asp:TextBox>

<asp:RequiredFieldValidator ID = "reqTo1" ControlToValidate = "txtTo"
runat = "server" ErrorMessage = "*" ></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID = "reqTo2" ControlToValidate =
"txtTo" runat = "server" ErrorMessage = "Invalid Email"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></
asp:RegularExpressionValidator>

</td>

</tr>

<tr>

<td valign="top"><font face="Verdana" size="2">Comments</font></td>

<td height="112" valign="top"><asp:TextBox runat="server"
Height="110px" TextMode="MultiLine" Width="368px" ID="txtComments"></
asp:TextBox>

<asp:RequiredFieldValidator ID = "reqComments" ControlToValidate =
"txtComments" Runat = "server" ErrorMessage = "*"></
asp:RequiredFieldValidator> </td>

</tr>

<tr>

<td colspan="2" valign="top" height="30">

<p align="center">

<asp:Button Runat = server ID = btnSubmit OnClick = btnSubmit_Click
Text = "Submit"></asp:Button>
&nbsp;<input id="Reset1" type = "reset" runat = "server" value =
"Clear"></td>
</tr>
</table>
</div>
<p>&nbsp;</p>
<p><br>

<!-- Insert content here -->
Content
</p>
</form>
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net.Mail" %>

Dim smtpClient As New SmtpClient()
Dim objMail As New MailMessage()

Dim objMail_fromaddress As New MailAddress(txtFrom.Text)

Dim objMail_fromaddress As New MailAddress(txtFrom.Text, "Learnxpress
Support")


Dim objMail_toaddress As New MailAddress(txtTo.Text)
objMail.From = objMail_fromaddress
objMail.To.Add(objMail_toaddress)
objMail.Subject = "E-mail Example - Visual Basic - Text"
objMail.Body = "Name: " &txtName.Text &vbCrLf & _
"Address: " &txtAddress.Text &vbCrLf & _
"Comments: " &txtComments.Text


objMail.Priority = MailPriority.High


smtpClient.Host = "mail.domain.com"
smtpClient.Credentials = New
System.Net.NetworkCredential("(e-mail address removed)","Password")

try

smtpClient.Send(objMail)

Response.Redirect("http://www.c-sharpcorner.com")

catch exc as Exception

Response.Write("Send failure: " + exc.ToString())

End Try
 
Ad

Advertisements

S

Steve

Your button is trying to call the btnSubmit_Click() event in your code,
but I don't see it in there? Maybe it got deleted?


Steve C.
MCSD,MCAD,MCSE,MCP+I,CNE,CNA,CCNA


I know I am missing something simple. Can someone help me identify
it? I am getting the following error:



*****************Error*********************************************

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: 'btnSubmit_Click' is not a member of
'ASP.emailforms_aspx'.

Source Error:



Line 67: <p align="center">
Line 68:
Line 69: <asp:Button Runat = server ID = btnSubmit OnClick =
btnSubmit_Click Text = "Submit"></asp:Button>
Line 70: &nbsp;<input id="Reset1" type = "reset" runat = "server"
value = "Clear"></td>
Line 71: </tr>


****************The Entire Page**********************************




<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div align="left">
<table> border="0" width="544"
<tr>
<td valign="top"><font face="Verdana" size="2">Name</font></td>
<td height="24" valign="top"> <asp:TextBox runat="server"
Height="25px" Width="370px" ID="txtName"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqName"
ControlToValidate="txtName" runat="Server" ErrorMessage="*"></
asp:RequiredFieldValidator></td>
</tr>
<tr>
<td valign="top"><font size="2" face="Verdana">Address</font></td>
<td height="24" valign="top">
<asp:TextBox runat="Server" Height="25px" Width="370px"
ID="txtAddress"></asp:TextBox></td>
</tr>
<tr>
<td valign="top"><font face="Verdana" size="2">From</font></td>
<td height="24" valign="top"> <asp:TextBox runat="server"
Height="22px" Width="368px"
ID="txtFrom"></asp:TextBox>
<asp:RequiredFieldValidator ID = "reqFrom1" ControlToValidate =
"txtFrom" runat = "server" ErrorMessage =
"*" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID = "regFrom2" ControlToValidate
= "txtFrom" runat = "server"
ErrorMessage = "Invalid Email" ValidationExpression="\w+([-+.]\w
+)*@\w+([-.]\w+)*\.\w+([-.]
\w+)*"></asp:RegularExpressionValidator>
<br></td>

</tr>

<tr>

<td valign="top"><font face="Verdana" size="2">To</font></td>

<td height="24" valign="top">

<asp:TextBox runat="server" Height="22px" Width="368px" ID="txtTo"></
asp:TextBox>

<asp:RequiredFieldValidator ID = "reqTo1" ControlToValidate = "txtTo"
runat = "server" ErrorMessage = "*" ></asp:RequiredFieldValidator>

<asp:RegularExpressionValidator ID = "reqTo2" ControlToValidate =
"txtTo" runat = "server" ErrorMessage = "Invalid Email"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></
asp:RegularExpressionValidator>

</td>

</tr>

<tr>

<td valign="top"><font face="Verdana" size="2">Comments</font></td>

<td height="112" valign="top"><asp:TextBox runat="server"
Height="110px" TextMode="MultiLine" Width="368px" ID="txtComments"></
asp:TextBox>

<asp:RequiredFieldValidator ID = "reqComments" ControlToValidate =
"txtComments" Runat = "server" ErrorMessage = "*"></
asp:RequiredFieldValidator> </td>

</tr>

<tr>

<td colspan="2" valign="top" height="30">

<p align="center">

<asp:Button Runat = server ID = btnSubmit OnClick = btnSubmit_Click
Text = "Submit"></asp:Button>
&nbsp;<input id="Reset1" type = "reset" runat = "server" value =
"Clear"></td>
</tr>
</table>
</div>
<p>&nbsp;</p>
<p><br>

<!-- Insert content here -->
Content
</p>
</form>
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net.Mail" %>

Dim smtpClient As New SmtpClient()
Dim objMail As New MailMessage()

Dim objMail_fromaddress As New MailAddress(txtFrom.Text)

Dim objMail_fromaddress As New MailAddress(txtFrom.Text, "Learnxpress
Support")


Dim objMail_toaddress As New MailAddress(txtTo.Text)
objMail.From = objMail_fromaddress
objMail.To.Add(objMail_toaddress)
objMail.Subject = "E-mail Example - Visual Basic - Text"
objMail.Body = "Name: " &txtName.Text &vbCrLf & _
"Address: " &txtAddress.Text &vbCrLf & _
"Comments: " &txtComments.Text


objMail.Priority = MailPriority.High


smtpClient.Host = "mail.domain.com"
smtpClient.Credentials = New
System.Net.NetworkCredential("(e-mail address removed)","Password")

try

smtpClient.Send(objMail)

Response.Redirect("http://www.c-sharpcorner.com")

catch exc as Exception

Response.Write("Send failure: " + exc.ToString())

End Try
 
Ad

Advertisements

M

Mark Rae [MVP]

I know I am missing something simple. Can someone help me identify
it?

You don't appear to have a btnSubmit_Click method in your server-side
code...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top