Oh, habe die Frage nicht ganz durchgelesen. Wichtig ist, dass du die Reihenfolge des "Life Cycles" beachtest. Interessant zu wissen ist auch, dass der .NET Framework ein "neues" Control immer synchronisiert, bis er dann weiter macht.

 

Wenn also deine Seite insgesamt bei Page_Load ist und du da das Control hinzuf�gst, dann wird der Life Cycle des Controls ebenfalls bis zu Page_Load abgearbeitet und dann laufen sie quasi gleichzeitig.

 

Die Reihenfolge insgesamt ist:

 

Initialize

Initialize settings needed during the lifetime of the incoming Web request. See Handling Inherited Events.

Init event (OnInit method)

Load view state

At the end of this phase, the ViewState property of a control is automatically populated as described in Maintaining State in a Control. A control can override the default implementation of the LoadViewState method to customize state restoration.

LoadViewState method

Process postback data

Process incoming form data and update properties accordingly. See Processing Postback Data.

Note   Only controls that process postback data participate in this phase.

LoadPostData method

(if IPostBackDataHandler is implemented)

Load

Perform actions common to all requests, such as setting up a database query. At this point, server controls in the tree are created and initialized, the state is restored, and form controls reflect client-side data. See Handling Inherited Events.

Load event

(OnLoad method)

Send postback change notifications

Raise change events in response to state changes between the current and previous postbacks. See Processing Postback Data.

Note   Only controls that raise postback change events participate in this phase.

RaisePostDataChangedEvent method

(if IPostBackDataHandler is implemented)

Handle postback events

Handle the client-side event that caused the postback and raise appropriate events on the server. See Capturing Postback Events.

Note   Only controls that process postback events participate in this phase.

RaisePostBackEvent method

(if IPostBackEventHandler is implemented)

Prerender

Perform any updates before the output is rendered. Any changes made to the state of the control in the prerender phase can be saved, while changes made in the rendering phase are lost. See Handling Inherited Events.

PreRender event

(OnPreRender method)

Save state

The ViewState property of a control is automatically persisted to a string object after this stage. This string object is sent to the client and back as a hidden variable. For improving efficiency, a control can override the SaveViewState method to modify the ViewState property. See Maintaining State in a Control.

SaveViewState method

Render

Generate output to be rendered to the client. See Rendering an ASP.NET Server Control.

Render method

Dispose

Perform any final cleanup before the control is torn down. References to expensive resources such as database connections must be released in this phase. See Methods in ASP.NET Server Controls.

Dispose method

Unload

Perform any final cleanup before the control is torn down. Control authors generally perform cleanup in Dispose and do not handle this event.

UnLoad event (On UnLoad method)

 

 

-----Urspr�ngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Alexander Zeitler
Gesendet: Donnerstag, 20. November 2003 19:06
An: [EMAIL PROTECTED]
Betreff: RE: [Asp.net] Frage zu LoadControl

 

Hallo,

 

>

> Ich m�chte mit LoadControl ein UserControl dyn. laden.

> Bis jetzt mache ich es noch statisch.

> Im CodeBehind ist das UC deklariert und im PageLoad werden noch n�tige

> Parameter festgelegt(z.B. uc.conn = MyConn).

> Wenn ich das uc jetzt mit LoadControl lade, scheint er das UC gleich zu

> verarbeiten, bevor ich noch die Parameter festlegen kann.

>

> Was muss ich machen, damit das doch geht?

>

 

hast Du den Aufruf der Methoden vielleicht im Page_Load Deines

Controls?

 

Du mu�t Dir ein eigenes "DataBind()" o.�. anlegen, mit dem Du

die Verarbeitung im Control h�ndisch anschubsen kannst.

 

Gruss

 

Alex

 

_______________________________________________

Asp.net mailing list

[EMAIL PROTECTED]

http://www.glengamoi.com/mailman/listinfo/asp.net

Antwort per Email an