[RESOLVED]Nested error messages

Hello

I am following an interesting VB.NET tutorial on uploading files. In the tutorial, there are only three files, aspx.vb, Web.config, and the aspx file which looks like this:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<body>
 <form id="form1" runat="server">     
   <div>
    <asp:FileUpload ID="FileUpload1" runat="server" /><br />
         <asp:Label ID="Label1" runat="server"></asp:Label><br />
         <asp:Button ID="Button1" runat="server" Text="Upload" />
     </div>
     </form>
 </body>

There is no reference to Site.Master along the top because there isn’t a Site.master file in the tutorial.

However, I know that if I use the above script in my own upload project, I am going to get an error about HTML nested forms because my project does have a Site.master file. So, my question is how do I use a form, as in the script above, while avoiding those
nested error messages?

Thank you.

Your project should have at-least one form tag.If its there then no need of another form tag.You can use fileupload.If you want to use two forms tag , then use
runat="server" on one form only.

Hello Ashim

Thank you for your reply.

I have this in my Site.master file:

<form runat="server">
        <asp:ScriptManager runat="server">
            <Scripts>
</Scripts>
        </asp:ScriptManager>

some HTML here

</form>
</body>

So, from the tutorial, I just use?

    <div>
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Upload" />
    </div>

Without the <form id="form1" runat="server">?

Thanks again.

Bluenose.

Bluenose

So, from the tutorial, I just use?

    <div>
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Upload" />
    </div>

Without the <form id="form1" runat="server">?

Yes.If you have a form tag in master page then there is no need to add another one.You can proceed with the leftover pice of codes in content page.

<div>
        <asp:FileUpload ID="FileUpload1" runat="server" />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Upload" />
</div>

Thanks for your help!

Blueie

Leave a Reply