Hello

I am getting 3 errors (same errors for all 3 lines) in my Visual Studio 2017 Web Forms project:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        pnlFormFields.Visible = False
        pnlThankYouMessage.Visible = True
        LblDate.Text = ReturnDate()

    End Sub

pnlFormFields, pnlThankYouMessage, and LblDate, are not declared.

In my aspx file, I have:

<body> <asp:Label ID = "LblDate" runat="server" CssClass="dateStyle" Text="Label"></asp:Label> <asp:Panel ID="pnlFormFields" runat="server"> <form id="form1" runat="server" method="post">

and

  <asp:Panel ID="pnlThankYouMessage" runat="server" CssClass="panel" Visible="False">

          Thank you. Your message has been sent.

          </asp:Panel>

What am I coding wrongly, please?

Thank you.

Be sure to have all the tags 'closed' (e.g. <asp:Panel ... /> or <asp:Panel .... > ....</asp:Panel>) and all enclosed inside <form>...</form>.
For example:

<body>
    <form id="form1" runat="server">
        <div>
            <asp:Label ID = "LblDate" runat="server" CssClass="dateStyle" Text="Label"></asp:Label>
            <asp:Panel ID="pnlFormFields" runat="server" /> 
            <asp:Panel ID="pnlThankYouMessage" runat="server" CssClass="panel" Visible="False">
                    Thank you. Your message has been sent.
            </asp:Panel>
        </div>
    </form>
</body>

Thanks xrjf for your reply.

I have done as you suggested, that is:

<body>

      <form id="form1" runat="server" method="post">

            <div>

       <asp:Label ID = "LblDate" runat="server" CssClass="dateStyle" Text="Label"></asp:Label>

        <asp:Panel ID="pnlFormFields" runat="server">
        <asp:Panel ID="pnlThankYouMessage" runat="server" CssClass="panel" Visible="False">

          Thank you. Your message has been sent.

         </asp:Panel>
        </div>

        <header>

Contact details

</header>

   <div id="footer" class="footerdiv">

Form fields

  </div>          

            </form>     

     </body>

I have run it through a HTML validator for stray divs, etc, and get no errors. But in my aspx.vb file, I still see the 3 errors (attached)

I am getting a sever error related to a DotNetAuth file, but doubt that is related to the above problem I have.

Is it where I have those three lines, that is, under Protected Sub Page_Load, that may be causing the problem?

Thanks again.

I think have sorted this problem out now, thanks!

I see tag <asp:Panel in line #9 open but never closed, is it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.