Code-Behind Page Inheritance
Now what about code-behind pages? Well, they
are basically exactly the same. See the sample below.
Public
Class CodeBehind :
Inherits
HeaderTemplate
Public Sub
Page_Load(ByVal
sender As
Object,
ByVal e
As
EventArgs)
MyBase.SampleText.Text
= "Hello there"
End
Sub
End
Class |
This is part of the same namespace that you
created before. If you run it on an ASPX page like
<%@ Inherits="AGASPTemplates.CodeBehind"
Src="TemplateCode.vb" %> |
Live Demo |
Now, if you look at the demo, you will see
that there is a problem. The page still shows - "This is a page
template sample" on it. This is because of the
page execution order.