473,385 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Init event for control doesn't fire

I have Panel control on the page. I am handling Init event for it. It
doesn't seem to fire at all. Why?
Thank you
Shimon.
Nov 19 '05 #1
6 2179
How are you registering for the Init event?

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have Panel control on the page. I am handling Init event for it. It
doesn't seem to fire at all. Why?
Thank you
Shimon.


Nov 19 '05 #2
Like this. All of them fire except for Init
#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

this.Betterpanel2.Load += new System.EventHandler(this.Betterpanel2_Load);

this.Betterpanel2.Unload += new
System.EventHandler(this.Betterpanel2_Unload);

this.Betterpanel2.PreRender += new
System.EventHandler(this.Betterpanel2_PreRender);

this.Betterpanel2.Init += new System.EventHandler(this.Betterpanel2_Init);

this.Betterpanel2.Disposed += new
System.EventHandler(this.Betterpanel2_Disposed);

InitializeComponent();

base.OnInit(e);

}
/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{
this.Disposed += new
System.EventHandler(this.CompositeControlTest_Disp osed);

this.Unload += new System.EventHandler(this.CompositeControlTest_Unlo ad);

this.Load += new System.EventHandler(this.Page_Load);

this.Init += new System.EventHandler(this.CompositeControlTest_Init );

this.PreRender += new
System.EventHandler(this.CompositeControlTest_PreR ender);

}

#endregion

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
How are you registering for the Init event?

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have Panel control on the page. I am handling Init event for it. It
doesn't seem to fire at all. Why?
Thank you
Shimon.


Nov 19 '05 #3
Well, that explains it :)

Child controls' OnInit is called before the Page's OnInit. You're registering
for the events too late. You can put <asp:Panel OnInit="MyEventHandler" ...
/> into the ASP directly and that will register your event handler when the
contol is created.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Like this. All of them fire except for Init
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

this.Betterpanel2.Load += new
System.EventHandler(this.Betterpanel2_Load);

this.Betterpanel2.Unload += new
System.EventHandler(this.Betterpanel2_Unload);

this.Betterpanel2.PreRender += new
System.EventHandler(this.Betterpanel2_PreRender);

this.Betterpanel2.Init += new
System.EventHandler(this.Betterpanel2_Init);

this.Betterpanel2.Disposed += new
System.EventHandler(this.Betterpanel2_Disposed);

InitializeComponent();

base.OnInit(e);

}

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.Disposed += new
System.EventHandler(this.CompositeControlTest_Disp osed);

this.Unload += new
System.EventHandler(this.CompositeControlTest_Unlo ad);

this.Load += new System.EventHandler(this.Page_Load);

this.Init += new System.EventHandler(this.CompositeControlTest_Init );

this.PreRender += new
System.EventHandler(this.CompositeControlTest_PreR ender);

}

#endregion

"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:11***********************@msnews.microsoft.co m...
How are you registering for the Init event?

-Brock
DevelopMentor
http://staff.develop.com/ballen
I have Panel control on the page. I am handling Init event for it.
It
doesn't seem to fire at all. Why?
Thank you
Shimon.


Nov 19 '05 #4
Thanks for Brock's Great explanation and suggestions.

Hi Shimon,

Like Brock has mentioned, the OnInit event of the Page is too late for
registering event handler for sub control(added statically)'s Init event).
Because all the static sub control's Init event is fired when they are
being added into the parent container which is before the Page's OnInit
function. You can try using Brock's suggetion on registering the event
handler in aspx page inline.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Message-ID: <11***********************@msnews.microsoft.com>
| From: Brock Allen <ba****@NOSPAMdevelop.com>
| Subject: Re: Init event for control doesn't fire
| References: <ew**************@TK2MSFTNGP09.phx.gbl>
| Mime-Version: 1.0
| Content-Transfer-Encoding: 8bit
| Content-Type: text/plain; charset=iso-8859-1; format=flowed
| X-Newsreader: JetBrains Omea Reader 469.1
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Date: Fri, 12 Aug 2005 14:09:39 -0700
| NNTP-Posting-Host: c-66-30-185-175.hsd1.ma.comcast.net 66.30.185.175
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:117757
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Well, that explains it :)
|
| Child controls' OnInit is called before the Page's OnInit. You're
registering
| for the events too late. You can put <asp:Panel OnInit="MyEventHandler"
...
| /> into the ASP directly and that will register your event handler when
the
| contol is created.
|
| -Brock
| DevelopMentor
| http://staff.develop.com/ballen
|
|
|
| > Like this. All of them fire except for Init
| > #region Web Form Designer generated code
| > override protected void OnInit(EventArgs e)
| >
| > {
| >
| > //
| >
| > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
| >
| > //
| >
| > this.Betterpanel2.Load += new
| > System.EventHandler(this.Betterpanel2_Load);
| >
| > this.Betterpanel2.Unload += new
| > System.EventHandler(this.Betterpanel2_Unload);
| >
| > this.Betterpanel2.PreRender += new
| > System.EventHandler(this.Betterpanel2_PreRender);
| >
| > this.Betterpanel2.Init += new
| > System.EventHandler(this.Betterpanel2_Init);
| >
| > this.Betterpanel2.Disposed += new
| > System.EventHandler(this.Betterpanel2_Disposed);
| >
| > InitializeComponent();
| >
| > base.OnInit(e);
| >
| > }
| >
| > /// <summary>
| >
| > /// Required method for Designer support - do not modify
| >
| > /// the contents of this method with the code editor.
| >
| > /// </summary>
| >
| > private void InitializeComponent()
| >
| > {
| >
| > this.Disposed += new
| > System.EventHandler(this.CompositeControlTest_Disp osed);
| >
| > this.Unload += new
| > System.EventHandler(this.CompositeControlTest_Unlo ad);
| >
| > this.Load += new System.EventHandler(this.Page_Load);
| >
| > this.Init += new System.EventHandler(this.CompositeControlTest_Init );
| >
| > this.PreRender += new
| > System.EventHandler(this.CompositeControlTest_PreR ender);
| >
| > }
| >
| > #endregion
| >
| > "Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
| > news:11***********************@msnews.microsoft.co m...
| >
| >> How are you registering for the Init event?
| >>
| >> -Brock
| >> DevelopMentor
| >> http://staff.develop.com/ballen
| >>> I have Panel control on the page. I am handling Init event for it.
| >>> It
| >>> doesn't seem to fire at all. Why?
| >>> Thank you
| >>> Shimon.
|

|
|

Nov 19 '05 #5
Thank a lot Brock and Steven.
I should have figured out the answer.
Shimon.
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:vD*************@TK2MSFTNGXA01.phx.gbl...
Thanks for Brock's Great explanation and suggestions.

Hi Shimon,

Like Brock has mentioned, the OnInit event of the Page is too late for
registering event handler for sub control(added statically)'s Init event).
Because all the static sub control's Init event is fired when they are
being added into the parent container which is before the Page's OnInit
function. You can try using Brock's suggetion on registering the event
handler in aspx page inline.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| Message-ID: <11***********************@msnews.microsoft.com>
| From: Brock Allen <ba****@NOSPAMdevelop.com>
| Subject: Re: Init event for control doesn't fire
| References: <ew**************@TK2MSFTNGP09.phx.gbl>
| Mime-Version: 1.0
| Content-Transfer-Encoding: 8bit
| Content-Type: text/plain; charset=iso-8859-1; format=flowed
| X-Newsreader: JetBrains Omea Reader 469.1
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Date: Fri, 12 Aug 2005 14:09:39 -0700
| NNTP-Posting-Host: c-66-30-185-175.hsd1.ma.comcast.net 66.30.185.175
| Lines: 1
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:117757
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Well, that explains it :)
|
| Child controls' OnInit is called before the Page's OnInit. You're
registering
| for the events too late. You can put <asp:Panel OnInit="MyEventHandler"
..
| /> into the ASP directly and that will register your event handler when
the
| contol is created.
|
| -Brock
| DevelopMentor
| http://staff.develop.com/ballen
|
|
|
| > Like this. All of them fire except for Init
| > #region Web Form Designer generated code
| > override protected void OnInit(EventArgs e)
| >
| > {
| >
| > //
| >
| > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
| >
| > //
| >
| > this.Betterpanel2.Load += new
| > System.EventHandler(this.Betterpanel2_Load);
| >
| > this.Betterpanel2.Unload += new
| > System.EventHandler(this.Betterpanel2_Unload);
| >
| > this.Betterpanel2.PreRender += new
| > System.EventHandler(this.Betterpanel2_PreRender);
| >
| > this.Betterpanel2.Init += new
| > System.EventHandler(this.Betterpanel2_Init);
| >
| > this.Betterpanel2.Disposed += new
| > System.EventHandler(this.Betterpanel2_Disposed);
| >
| > InitializeComponent();
| >
| > base.OnInit(e);
| >
| > }
| >
| > /// <summary>
| >
| > /// Required method for Designer support - do not modify
| >
| > /// the contents of this method with the code editor.
| >
| > /// </summary>
| >
| > private void InitializeComponent()
| >
| > {
| >
| > this.Disposed += new
| > System.EventHandler(this.CompositeControlTest_Disp osed);
| >
| > this.Unload += new
| > System.EventHandler(this.CompositeControlTest_Unlo ad);
| >
| > this.Load += new System.EventHandler(this.Page_Load);
| >
| > this.Init += new System.EventHandler(this.CompositeControlTest_Init );
| >
| > this.PreRender += new
| > System.EventHandler(this.CompositeControlTest_PreR ender);
| >
| > }
| >
| > #endregion
| >
| > "Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
| > news:11***********************@msnews.microsoft.co m...
| >
| >> How are you registering for the Init event?
| >>
| >> -Brock
| >> DevelopMentor
| >> http://staff.develop.com/ballen
| >>> I have Panel control on the page. I am handling Init event for it.
| >>> It
| >>> doesn't seem to fire at all. Why?
| >>> Thank you
| >>> Shimon.
|

|
|

Nov 19 '05 #6
You're welcome Shimon,

Always feel free to post here if there are anything we can help you.
Have a good day!

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Shimon Sim" <sh**********@community.nospam>
| References: <ew**************@TK2MSFTNGP09.phx.gbl>
<11***********************@msnews.microsoft.com>
<vD*************@TK2MSFTNGXA01.phx.gbl>
| Subject: Re: Init event for control doesn't fire
| Date: Tue, 16 Aug 2005 09:18:12 -0400
| Lines: 146
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| Message-ID: <#B**************@TK2MSFTNGP12.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.optonline.net 68.192.89.34
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP12.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:118236
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thank a lot Brock and Steven.
| I should have figured out the answer.
| Shimon.
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:vD*************@TK2MSFTNGXA01.phx.gbl...
| > Thanks for Brock's Great explanation and suggestions.
| >
| > Hi Shimon,
| >
| > Like Brock has mentioned, the OnInit event of the Page is too late for
| > registering event handler for sub control(added statically)'s Init
event).
| > Because all the static sub control's Init event is fired when they are
| > being added into the parent container which is before the Page's OnInit
| > function. You can try using Brock's suggetion on registering the event
| > handler in aspx page inline.
| >
| > Thanks & Regards,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| > --------------------
| > | Message-ID: <11***********************@msnews.microsoft.com>
| > | From: Brock Allen <ba****@NOSPAMdevelop.com>
| > | Subject: Re: Init event for control doesn't fire
| > | References: <ew**************@TK2MSFTNGP09.phx.gbl>
| > | Mime-Version: 1.0
| > | Content-Transfer-Encoding: 8bit
| > | Content-Type: text/plain; charset=iso-8859-1; format=flowed
| > | X-Newsreader: JetBrains Omea Reader 469.1
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | Date: Fri, 12 Aug 2005 14:09:39 -0700
| > | NNTP-Posting-Host: c-66-30-185-175.hsd1.ma.comcast.net 66.30.185.175
| > | Lines: 1
| > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:117757
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Well, that explains it :)
| > |
| > | Child controls' OnInit is called before the Page's OnInit. You're
| > registering
| > | for the events too late. You can put <asp:Panel
OnInit="MyEventHandler"
| > ..
| > | /> into the ASP directly and that will register your event handler
when
| > the
| > | contol is created.
| > |
| > | -Brock
| > | DevelopMentor
| > | http://staff.develop.com/ballen
| > |
| > |
| > |
| > | > Like this. All of them fire except for Init
| > | > #region Web Form Designer generated code
| > | > override protected void OnInit(EventArgs e)
| > | >
| > | > {
| > | >
| > | > //
| > | >
| > | > // CODEGEN: This call is required by the ASP.NET Web Form Designer.
| > | >
| > | > //
| > | >
| > | > this.Betterpanel2.Load += new
| > | > System.EventHandler(this.Betterpanel2_Load);
| > | >
| > | > this.Betterpanel2.Unload += new
| > | > System.EventHandler(this.Betterpanel2_Unload);
| > | >
| > | > this.Betterpanel2.PreRender += new
| > | > System.EventHandler(this.Betterpanel2_PreRender);
| > | >
| > | > this.Betterpanel2.Init += new
| > | > System.EventHandler(this.Betterpanel2_Init);
| > | >
| > | > this.Betterpanel2.Disposed += new
| > | > System.EventHandler(this.Betterpanel2_Disposed);
| > | >
| > | > InitializeComponent();
| > | >
| > | > base.OnInit(e);
| > | >
| > | > }
| > | >
| > | > /// <summary>
| > | >
| > | > /// Required method for Designer support - do not modify
| > | >
| > | > /// the contents of this method with the code editor.
| > | >
| > | > /// </summary>
| > | >
| > | > private void InitializeComponent()
| > | >
| > | > {
| > | >
| > | > this.Disposed += new
| > | > System.EventHandler(this.CompositeControlTest_Disp osed);
| > | >
| > | > this.Unload += new
| > | > System.EventHandler(this.CompositeControlTest_Unlo ad);
| > | >
| > | > this.Load += new System.EventHandler(this.Page_Load);
| > | >
| > | > this.Init += new
System.EventHandler(this.CompositeControlTest_Init );
| > | >
| > | > this.PreRender += new
| > | > System.EventHandler(this.CompositeControlTest_PreR ender);
| > | >
| > | > }
| > | >
| > | > #endregion
| > | >
| > | > "Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
| > | > news:11***********************@msnews.microsoft.co m...
| > | >
| > | >> How are you registering for the Init event?
| > | >>
| > | >> -Brock
| > | >> DevelopMentor
| > | >> http://staff.develop.com/ballen
| > | >>> I have Panel control on the page. I am handling Init event for it.
| > | >>> It
| > | >>> doesn't seem to fire at all. Why?
| > | >>> Thank you
| > | >>> Shimon.
| > |
| >
| > |
| > |
| >
|
|
|

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Anatoly | last post by:
Put any control on web page. create Init event for ths control. Write Response.Write("here") inside this event. Compile\build\run. I never saw "here" string appear on web page. Why???
3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
9
by: J.Marsch | last post by:
I must be missing something here: The Init event for controls does not seem to fire. What I did: Drop a textbox on a blank webform, hook the textbox's Init event. Code: this.Textbox1.Value =...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
4
by: Barb | last post by:
I have a user control as my Save button for my page. When the Save button is clicked, I want some client-side validation to take place from a javascript function in the page, and then I'd like the...
10
by: Wylbur via DotNetMonster.com | last post by:
Hello to all of you geniuses, I'm having a problem trying to get an Init handler to fire for a Placeholder control at the initialization phase. I’ve posted this problem to 3 other ASP.NET...
9
by: jeff | last post by:
New VB user...developer... Situation...simplified... - I want to wrap a pre and post event around a system generated where the pre-event will always execute before the system event and the...
5
by: rn5a | last post by:
Consider the following user control which resides in Address.ascx: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)...
6
by: MLH | last post by:
I have a form, frmUSPSReturnReceipts, with a control named NotExpectingGreenTickets. The control's Exit event procedure follows: Private Sub NotExpectingGreenTickets_Exit(Cancel As Integer) If...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.