Click here to Skip to main content
13,446,392 members (34,798 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Why this error is giving 'panelSendEmail' is not declared. It may be inaccessible due to its protection level

My code is

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="feedback webmail.aspx.vb" Inherits="feedback_webmail" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head  runat="server">
    <form id="form1"  runat="server">
    <h2>We are interested in your feedback!  Please enter the following
      requested information below to send us your comments.</h2></panel>

      Your Name:
      <asp:textbox id="txtName" runat="server" />

      Your Email Address:
      <asp:textbox id="txtEmail" runat="server" />

      Your Message:<br>
      <asp:textbox id="txtMessage" TextMode="MultiLine"

                      Columns="40" Rows="10" runat="server" />

      <asp:button runat="server" id="btnSendFeedback" Text="Send Feedback!"/>

coading part

Inherits System.Web.UI.Page
    Protected Sub btnSendFeedback_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSendFeedback.Click
        'Create an instance of the MailMessage class
        Dim objMM As New MailMessage()

        'Set the properties - send the email to the person who filled out the
        'feedback form.
        objMM.To = ""
        objMM.From = txtEmail.Text

        'If you want to CC this email to someone else, uncomment the line below
        'objMM.Cc = ""

        'If you want to BCC this email to someone else, uncomment the line below
        'objMM.Bcc = ""

        'Send the email in text format
        objMM.BodyFormat = MailFormat.Text
        '(to send HTML format, change MailFormat.Text to MailFormat.Html)

        'Set the priority - options are High, Low, and Normal
        objMM.Priority = MailPriority.Normal

        'Set the subject
        objMM.Subject = "Feedback"

        'Set the body
        objMM.Body = "At " + DateTime.Now + " feedback was sent from an ASP.NET " & _
                     "Web page.  Below you will find the feedback message " & _
                     "send by " & txtName.Text & "." & vbCrLf & vbCrLf & _
                     "---------------------------------------" & vbCrLf & vbCrLf & _
                     txtMessage.Text & vbCrLf

        'Specify to use the default Smtp Server
        SmtpMail.SmtpServer = ""

        'Now, to send the message, use the Send method of the SmtpMail class

        panelSendEmail.Visible = False
        panelMailSent.Visible = True

    End Sub
End Class
Posted 10-Nov-11 1:09am
Updated 10-Nov-11 1:13am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

In your aspx page there is no control with name panelSendEmail
and in code behind your are trying to make its visibility false

that's why you got this error.
so check it.
Janardan Pandey 10-Nov-11 7:18am
How to create this in aspx.I am trying but not sucess.Please help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180314.2 | Last Updated 10 Nov 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100