473,322 Members | 1,719 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,322 software developers and data experts.

Losing Event Wireup Code

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
3 2882
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Oisin Grehan | last post by:
Hi, I have a UserControl derived class: <ns:votingbutton runat="server" id="btn1" onclick="votingbuttonclick" /> My question is, what code do I need in place in the codebehind for this to...
1
by: Maurice Walmsley | last post by:
hello and thanks I am as green as mold when it comes to asp.net, so please bear with me. I am trying to get an asp.net page with a webform to work using codebehind. My class/routines work...
1
by: Roger | last post by:
My page_load event doesn't fire if I close my browser and reopen it to the same page. Any reason why? Is there something I need to set in my web.config or global.asax? Right now, I don't have...
3
by: localhost | last post by:
In my ASP.NET page code-behind, I have added a textbox like this: (C#) System.Web.UI.HtmlControls.HtmlGenericControl div1= new HtmlGenericControl( "div" ); div1.ID = "divNewTextBox";...
5
by: fbwhite | last post by:
I know this issue has been brought up many times, but I have tried many of the solutions to no avail. I wanted to give my specific case to see if someone could be of any help. We are using the...
3
by: csgraham74 | last post by:
Hello, Ive been working on an asp.net application in both dreamweaver and visual studio .Net. Ive imported files created in dreamweaver into my VS.Net application. The main problem that i...
6
by: Joseph Geretz | last post by:
I'm porting a C# Outlook Addin originally engineered as a COM Addin over to use VSTO. I've gotten this to the point where my VSTO Addin installs its Menu items and Toolbar buttons when Outlook...
6
by: Mark Chambers | last post by:
Hi there, Does anyone know why the "ColumnChanged" event isn't fired when "Merge()" is called below. "OnRowChanged()" is fired however: Thanks in advance. private static void Test() {...
5
by: Andrew Robinson | last post by:
I have a page that can load a number of different user controls. Each of these user controls inherits from a common base class and the controls are loaded based on application state, status, etc...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.