Help For Newbie Please

Discussion in 'ASP .Net' started by bgreer5050@yahoo.com, Aug 28, 2007.

  1. Guest

    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("","Password")

    try

    smtpClient.Send(objMail)

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

    catch exc as Exception

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

    End Try
     
    , Aug 28, 2007
    #1
    1. Advertising

  2. Steve Guest

    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


    wrote:
    > 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("","Password")
    >
    > try
    >
    > smtpClient.Send(objMail)
    >
    > Response.Redirect("http://www.c-sharpcorner.com")
    >
    > catch exc as Exception
    >
    > Response.Write("Send failure: " + exc.ToString())
    >
    > End Try
    >
     
    Steve, Aug 28, 2007
    #2
    1. Advertising

  3. <> wrote in message
    news:...
    >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...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Aug 28, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JC
    Replies:
    4
    Views:
    8,004
    Jeff C
    Jul 8, 2004
  2. Replies:
    4
    Views:
    541
    Chris Uppal
    May 5, 2005
  3. KK
    Replies:
    2
    Views:
    646
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,785
    Mike Hewson
    Jan 7, 2005
  5. mera
    Replies:
    7
    Views:
    1,130
Loading...

Share This Page