aspx inheritance woes

    Date: 06/29/06 (Asp Dot Net)    Keywords: asp, web

    Want to see something wonderful? Fire up visual studio and start a new asp.net web application.

    Make WebForm1.aspx look like this:

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication1.child"%>

    And make WebForm1.aspx.vb look like this:

    Public Class parent
        Inherits System.Web.UI.Page
    
        Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Response.Write("parent.Page_Load")
        End Sub
    End Class
    
    Public Class child
        Inherits parent
    
        Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Response.Write("child.Page_Load")
        End Sub
    End Class

    Press F5. The resulting page will only say "parent.Page_Load". If you go back and look at WebForm1.aspx, you will see that visual studio has changed "child" to "parent" for you! You can go ahead and change it back, but the next time you recompile, it will change it for you again!

    Source: http://community.livejournal.com/aspdotnet/71780.html

« more gridview woes || RegularExpression Help »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home