DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 19 Aug 2007 16:01:50 -0500,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    Sergio E. gruporemp[ARROBA]hotmail.com


event handler isn't working   
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).id="LocalCbo"+i.tostring()
me.cbos(i).datasource = me.dts(i)
me.cbos(i).datatextfield="colText"
me.cbos(i).datavaluefield="colId"
me.cbos(i).autopostback=true
me.cbos(i).enableviewstate=true
Dim eh As EventHandler = New EventHandler(AddressOf 
Me.Cbo_SelectedIndexChanged)
AddHandler Me.ddls(i).SelectedIndexChanged, eh
'AddHandler ddl.SelectedIndexChanged, AddressOf Me.Cbo_SelectedIndexChanged 
' it don't work too
me.cbos(i).databind()
me.cbos(i).selectedvalue=me.selvals(i)
me.controls.add(me.cbos(i))
next
end sub


Protected Sub Cbo_SelectedIndexChanged(ByVal sender As Object, ByVal e As 
EventArgs)
'Here goes the code to execute, by now i use a test
response.write(me.cbos(0).selectedvalue)
'this method hasn't reached
end sub
end class


What I'm doing wrong?
Thank you!
-- 
Greetings,
Sergio E.
Date:Sun, 19 Aug 2007 16:01:50 -0500   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us