Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > event handler isn't working

Thread Tools

event handler isn't working

Sergio E.
Posts: n/a
Hello, I am extending a webcontrol, and I need to generate an array of
objects of type dropdownlist, whose event selectedindexchanged must fires an
own method called Cbo_SelectedIndexChanged that has the same signature of
selectedindexchanged of a normal dropdownlist. I already tried to add the
handler to them with addhandler but the event does not go off. I already
debug it line by line and the first timethe page with the control draws
correctly, dropdownlists fill correctly but when changing some value of any
of them it does not work, the method never is reached. I don't know if it is
because I don't defined the withevents modifier for each dropdownlist, but
the compiler gives me an error if I do "protected withevents cbos() as
dropdownlist" and I don't know how add to it when it's in an array.

The source code involved is this:

public class myExtendedPanel
inherits panel
protected cbos() as dropdownlist

private sub GenerateCbos(byval maxcbos as integer)
redim me.cbos(0 to maxcbos)
for i as integer = 0 to maxcbos
me.cbos(i) = new dropdownlist()
me.cbos(i).datasource = me.dts(i)
Dim eh As EventHandler = New EventHandler(AddressOf
AddHandler Me.ddls(i).SelectedIndexChanged, eh
'AddHandler ddl.SelectedIndexChanged, AddressOf Me.Cbo_SelectedIndexChanged
' it don't work too
end sub

Protected Sub Cbo_SelectedIndexChanged(ByVal sender As Object, ByVal e As
'Here goes the code to execute, by now i use a test
'this method hasn't reached
end sub
end class

What I'm doing wrong?
Thank you!
Sergio E.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Handler that creates adds another event handler ASP .Net 1 02-22-2007 07:37 AM
problem in changing the actual event handler into our own event Javascript 0 10-30-2006 02:32 PM
rendering Button inside Render() event, makes it loose its click event handler association sonic ASP .Net 1 01-07-2005 06:33 PM
How to recall add event from an Event handler?? RC ASP .Net Web Controls 1 01-06-2005 07:44 PM
Passing event from dynamically created element and event handler? Adi Javascript 2 02-23-2004 02:44 PM