Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control firing wring Event Handler

Status
Not open for further replies.

markknowsley

Programmer
Aug 30, 2005
152
0
0
GB
I have two DropDownLists on a web form:
List1
List2

and each has their own event handler:
List1_SelectedIndexChanged
List2_SelectedIndexChanged

there is also a third event handler which is for a list on a different section of the page
List3_SelectedIndexChanged

These event handlers are correctly assigned in the asp code. So I change List1, which fires its event handler (part of this is to enable List2 if SelectedIndex > 0) correctly. I now pick an option from List2 - but it refuses to fire its own event handler, and fires List3_SelectedIndexChanged instead.

I've had problems with Visual Studio 'adding code' before but never this bad - which I'm assuming is what's happening here. I remember in VS2003 there was an auto-generated code section where the event handlers were created and could be switched between controls - but this feature seems to have gone in VS2005.

Does anyone know how I can fix this?
 
Open the File which contains ".Designer.cs" and search for the pattern "List2.SelectedIndexChanged += "
In this line the EventHandler for List2 (if its the correct name) is assigned. Change it and everything should be fine
 
There's no .Designer.cs file that's specific to the project that I'm working on - in fact there are none inside the folder for any of the pages of code.

Any other ideas?
 
Are you working with VS 2005 or VS.NET? In VS.NET there is no .Designer.cs but all the generated code is in the cs-file of your Form.

In fact you only have to search for the pattern in all you source-files
 
If you are using VS.NET 2005...
In Solution Explorer, click on 'Show all Files' button. This will give you .Designer.cs file when you open '+' for that file.

Sharing the best from my side...

--Prashant--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top