Das m�sste helfen

 

ms-help://MS.NETFrameworkSDK/cpref/html/frlrfSystemWebUITemplateControlClassLoadControlTopic.htm

 

hier der auszug

 

 

<%@ Page Language='c#'%>
<%@ Reference Control='Logonform.cs.ascx' %>
<html>
 <head>
 <script language="C#" runat="server">
 void Page_Init(object sender, System.EventArgs e)
 {
 Response.Write("<h4><b> A Reusable Simple User Control</b></h4><br>");
 // Obtain a UserControl object 'LogOnControl' from the user control file 'Logonform.ascx'.
 LogOnControl myControl = (LogOnControl)LoadControl("Logonform.cs.ascx");
 Controls.Add(myControl);
 }
 </script>
 </head>
</html>
[Visual Basic] 
'File name: logoncontrol.vb
 Imports System
 Imports System.Web.UI
 Imports System.Web.UI.WebControls
 
 Public Class LogOnControl Inherits UserControl
 Public user As TextBox
 Public password As TextBox
 End Class 'LogOnControl
 
 
'File name: Logonform.vb.ascx
 
<%@ control inherits = "LogOnControl" src = "" %>
 
 <table  10pt verdana;border-width:1;border-style:solid;border-color:black;" cellspacing=15>
 <tr>
 <td><b>Login: </b></td>
 <td><ASP:TextBox id="user" runat="server"/></td>
 </tr>
 <tr>
 <td><b>Password: </b></td>
 <td><ASP:TextBox id="password" TextMode="Password" runat="server"/></td>
 </tr>
 <tr></tr>
 </table>

 

 

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Im Auftrag von A-Schubert
Gesendet: Freitag, 24. Januar 2003 11:34
An: [EMAIL PROTECTED]
Betreff: [Asp.net] Vererbung

 

Hallo noch mal,

 

ich habe ein Webform das hei�t default.aspx.

Innerhalb dieser Webform registriere ich mehrere UserControls.

Das klappt auch alles wunderbar.

Jetzt m�chte ich gerne innerhalb der Usercontrols auf alle Variablen und Methoden

des Webforms zugreifen. Wie geht das?

Ich habe es versucht �ber die Inherits Directive zu l�sen, hat aber nicht funktioniert. ;(

 

Gibt es da einen anderen Weg ?

 

Mit freundlichen Gr��en

Andr� Schubert

T-Systems Nova GmbH
Entwicklungszentrum Berlin
Hausanschrift: Wittestr. 30H  13509 Berlin
Telefon: (0 30) 4 35 77-7881


E-Mail:   [EMAIL PROTECTED]
Internet: http://www.t-systems.com

 

Antwort per Email an