So I'm not sure what is going on. My boss was not happy with me using MVC and Razor, so I have to code this nasty webcontrol / codebehind style. = /
Error:
Only Content controls are allowed directly in a content page that contains Content controls.
Here is the main page:
<%@ Master Language="C#"%> <!DOCTYPE html> <html> <head> <title>Application Form</title> </head> <body> <div id="container"> <asp:contentplaceholder id="contentPlaceHolder" runat="server" /> </div> </body> </html>
And here is the Default.aspx page that throws an error.
<%@ Page Language="C#" Inherits="dumb.Default" MasterPageFile="MasterPage.master" %> <h2>Application Form</h2> <asp:Content id="content" ContentPlaceHolderID="contentPlaceHolder" runat="server"> <p>Please complete this application.</p> <form action="Default.aspx" method="post" runat="server"> <div> <span class="spaced">Name:</span><asp:TextBox id="name" runat="server" /> </div> </form> <p> <asp:Label id="finalmessage" runat="server" /> </p> </asp:Content>
And the stupid Default.aspx.cs codebehind ...
using System; using System.Web; using System.Web.UI;
namespace dumb { public partial class Default : System.Web.UI.Page { protected void Page_Load (object sender, EventArgs e) { if (IsPostBack) { finalmessage.Text = "Submission Processed Successfully!"; } } } }
user798080
source share