asp.net error form cannot be nested within element form? -
i have content page in asp.net application uses form tag. there's 1 on page i'm confused why give me error: validation (html5): element 'form' must not nested within element 'form'
heres code:
<%@ page language="c#" autoeventwireup="true" masterpagefile="~/site.master" codebehind="default.aspx.cs" inherits="webapplication6._default" %> <asp:content id="content1" runat="server" contentplaceholderid="maincontent"> <div> <form id="form1"> <asp:gridview id="gridview1" runat="server" allowsorting="true" autogeneratecolumns="false" datakeynames="id" datasourceid="sqldatasource1" allowpaging="true" onselectedindexchanged="gridview1_selectedindexchanged"> <columns> <asp:boundfield datafield="id" headertext="id" insertvisible="false" readonly="true" sortexpression="id" /> <asp:boundfield datafield="title" headertext="title" sortexpression="title" /> <asp:boundfield datafield="director" headertext="director" sortexpression="director" /> <asp:boundfield datafield="datereleased" headertext="datereleased" sortexpression="datereleased" /> <asp:templatefield headertext="selection"> <itemtemplate> <asp:checkbox id="selections" runat="server" oncheckedchanged="checkbox1_checkedchanged1" /> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> <asp:sqldatasource id="sqldatasource1" runat="server" connectionstring="<%$ connectionstrings:connectionstring %>" selectcommand="select * [movies]"></asp:sqldatasource> <asp:button id="button1" runat="server" text="select movies" onclick="button1_click" causesvalidation="false" /> <asp:textbox id="textbox1" text="first name" runat="server"></asp:textbox> </form> </div> </asp:content>
i have form in masterpage wasnt giving me problems yesterday..
any ideas?
if <asp:contentplaceholder id="maincontent" >
control is, itself, inside of form
element, shouldn't place form
inside of asp:content
control should not have nested forms.
from html5 working draft:
4.10.3 form element
content model:
flow content, no form element descendants.
update
see question a page can have 1 server-side form tag:
master pages should not contain form tags in general because meant used base layout of content page.
try restructure project using these guidelines:
- only add
form
elements aspx pages - add main content
masterpage
pages - add content needs nested within form
usercontrol
placed within page.
Comments
Post a Comment