Grr. jeg kan ikke få det til at virke med codebehind.
Default.aspx:
<%@ Register TagPrefix="uc1" TagName="Top" Src="Top.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="default.aspx.vb" Inherits="skabelon.design"%>
<uc1:top id="Top1" runat="server"></uc1:top>
Default.aspx.vb
Public Class design
Inherits System.Web.UI.Page
Private Title As String
Private Top1 As UserControl
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Top.ascx
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Top.ascx.vb" Inherits="skabelon.Top" TargetSchema="
http://schemas.microsoft.com/intellisense/ie5" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>
<head>
<title>
<%=Title%>
</title>
Top.ascx.vb
Public MustInherit Class Top
Inherits System.Web.UI.UserControl
Public Title As String
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class