By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Losing Event Wireup Code

P: n/a
I am so happy to have mastered the technique for "Press Tab to
insert".
I type " += " and up steps Visual Studio to write my event handler for
me.
This is more fun than Intellisense.

But I keep losing my Event Wireup, or Delegate Assignment, code from
the "InitializeComponent" section of the page.

For example,
I just had to re-insert the following into InitializeComponent :

this.bttnGo.Click +=new EventHandler(bttnGo_Click);

Anybody else experience this in C# ASP .NET?

Brian
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I've seen this happen frequently when copying and pasting controls.

You can also go to the events view of the property window and reselect the
appropriate handler.

HTH;
Eric Cadwell
http://www.origincontrols.com
Nov 15 '05 #2

P: n/a
Hi Brian,

There was another post today regarding this, it seems that
InitializeComponent method is not a safe place to put your code, I would
suggest you to put the code in other place like in the Load handler, in fact
I just took a look at one of my pages and this is the comment above that
method:

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Brian" <bo***@vafb.com> wrote in message
news:d2*************************@posting.google.co m...
I am so happy to have mastered the technique for "Press Tab to
insert".
I type " += " and up steps Visual Studio to write my event handler for
me.
This is more fun than Intellisense.

But I keep losing my Event Wireup, or Delegate Assignment, code from
the "InitializeComponent" section of the page.

For example,
I just had to re-insert the following into InitializeComponent :

this.bttnGo.Click +=new EventHandler(bttnGo_Click);

Anybody else experience this in C# ASP .NET?

Brian

Nov 15 '05 #3

P: n/a
Thanks everybody!

Your tips are both helpful.
I had never used the "Events" window before.

I thought the comment about staying out of the "init" code was only
applicable to people using "AutoEventWireUp".

I will use both techniques you offered where needed.

Brian
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.