Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty Stack error when adding form tag to an ASP.Net Webforms page

Ok, so, I am coming from the world of ASP programming - ASP.NET is somewhat new, and I am using Visual Studio 2013.

So, I am getting this error message when I am simply just just trying to build a simple form:

Server Error in '/' Application.

Stack empty.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Stack empty.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 


[InvalidOperationException: Stack empty.]
   System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) +52
   System.Collections.Generic.Stack`1.Pop() +6694385
   Microsoft.VisualStudio.Web.PageInspector.Runtime.WebForms.SelectionMappingRenderTraceListener.EndRendering(TextWriter writer, Object renderedObject) +85
   System.Web.UI.RenderTraceListenerList.EndRendering(TextWriter writer, Object renderedObject) +58
   System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +142
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
   System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1386

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18408

What in the world does all that mean?

The page seems to break when I put a <form> tag around this:

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

<asp:TextBox ID="post_feedback" runat="server" Height="100" Width="500" BackColor="#0066FF" Font-Bold="True" ForeColor="#FF9933" Wrap="False" TextMode="MultiLine" BorderColor="#000099" BorderStyle="Groove" BorderWidth="2"></asp:TextBox>  

</form>

But when I remove the form tag and "run" it, I don't that long stack error. I haven't even done anything with the *.aspx.cs file yet; there's no function calls being made, nothing.

So what in the world does this all mean? I'm really lost. Thank you.

like image 624
user3768848 Avatar asked Aug 18 '26 22:08

user3768848


2 Answers

In ASP.Net, unless you're careful to specify an MVC site without WebForms, there is One True FormTM. You don't add your own form tags to the page. You process events created from postbacks using that one form that Visual Studio helpfully puts into the page for you.

like image 127
Joel Coehoorn Avatar answered Aug 21 '26 13:08

Joel Coehoorn


I had a asp:Panel with property DefaultButton="someButtonID" defined. but the someButtonID didnt exist!

I just removed DefaultButton="someButtonID".

like image 40
Moslem Hady Avatar answered Aug 21 '26 13:08

Moslem Hady



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!