Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with events in default.aspx page (ASP.net 3.5)

I am having problems with an asp.net webform that uses a master page. The problem only occurs when the page is named default.aspx. When named default.aspx if there is any code in the Page_Load event, other events do not fire. This also includes all code commented out I've tested OnInit and Button click events, the problem first manifested itself with button clicks not firing.

Default.aspx code

<%@ Page Title="" Language="C#" MasterPageFile="~/TWS/tws.Master" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="SITMComAU.TWS.original" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyPlaceholder" runat="server">
</asp:Content>

OnInit Fires: - Checked Via Break Point

 public partial class original : System.Web.UI.Page
 {
    protected void Page_Load(object sender, EventArgs e)
    {


    }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        int a = 1;
        int b = 2;
        int c = a;
    }
}

OnInit Does Not Fire: - Checked Via Break Point

 public partial class original : System.Web.UI.Page
 {
    protected void Page_Load(object sender, EventArgs e)
    {
       /*
            int y = 5;
            int z = y - 1;
         */         
    }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        int a = 1;
        int b = 2;
        int c = a;
    }
}

OnInit Does Not Fire: - Checked Via Break Point

 public partial class original : System.Web.UI.Page
 {
    protected void Page_Load(object sender, EventArgs e)
    {

            int y = 5;
            int z = y - 1;

    }

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        int a = 1;
        int b = 2;
        int c = a;
    }
}

All of the above work if the aspx, cs and designer files are renamed to anything other than default.

As for the master page. It is layout only, there is no functionality in the .cs file.

What I have tried:

  • Restarting Visual Studio
  • Rebooting
  • Removing dll, pdb files from bin
  • Voodoo
  • Pulling out my hair
  • Pulling out others hair

I hope some one can help!

like image 652
Jon P Avatar asked Sep 19 '11 08:09

Jon P


1 Answers

May be the event is being fired and its just a problem with Visual Studio debugger that you are not hitting the break point. Try to write some file and see if that happens.

like image 99
user961954 Avatar answered Nov 14 '22 23:11

user961954