add an Init event handler for your control (from http://www.aspalliance.com/aspxtreme/sys/Web/UI/ControlClassInit.aspx)void Page_Init (object sender,EventArgs e) { // add an event Handler for 'Init'. myControl.Init += new System.EventHandler(Control_Init); }void Control_Init (object sender,EventArgs e) { Response.Write ("The ID of the object initially : " + myControl.ID); // change the ID property. myControl.ID="TestControl"; Response.Write ("<br>The changed ID : " + myControl.ID); }
iTypeID =UserControlName .TypeID;
就是在加载窗体的事件里同时执行啊
要不你怎么加载窗体啊??????!!!!
在一个页面(Page)里,加入了一个UserControl。我想让UserControl的Page_Load代码比页面(Page)的Page_Load里的代码先执行。 也就是更改它们的执行顺序,请教大侠,可以实现吗???
{
// add an event Handler for 'Init'.
myControl.Init += new System.EventHandler(Control_Init);
}void Control_Init (object sender,EventArgs e) {
Response.Write ("The ID of the object initially : " + myControl.ID);
// change the ID property.
myControl.ID="TestControl";
Response.Write ("<br>The changed ID : " + myControl.ID);
}