473,394 Members | 2,048 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,394 software developers and data experts.

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.

Aug 19 '07 #1
0 1161

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: TheKeith | last post by:
Can someone tell me why this isn't working? <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script...
3
by: delerious | last post by:
I have a DIV that contains some links. I have an onmouseout event handler on the DIV, and I want it triggered only when the mouse leaves the DIV. Since there are Anchors in the DIV, onmouseout...
4
by: Pai | last post by:
hello there, I am trying to rersize the window it works find in IE but doea not work with mozilla window.attachEvent(onload,MWSOnLoad); window.onload = function (MWSOnLoad) { alert('hello');...
3
by: N. Demos | last post by:
How do you dynamically assign a function to an element's event with specific parameters? I know that the code is different for MSIE and Mozilla, and need to know how to do this for both. I...
2
by: Tom | last post by:
hi guys I have a problem a event bubble that isn't working. isn't working= I've opened up a handle in my user control but when I try to use it ie. ok I am trying to assign an event handler from...
15
by: Amit D.Shinde | last post by:
I am adding a new picturebox control at runtime on the form How can i create click event handler for this control Amit Shinde
3
by: Beth | last post by:
in the following: this.ExitButton.Click += new System.EventHandler(this.ExitButton_Click); if I saw an equation, such as y +=x; then y = y+x. But what is the meaning in the event handler. I...
6
by: Joseph Geretz | last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm adding matching pairs of Toolbar buttons and Menu items. All of the buttons and menu items are wired up to send events to...
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...
17
by: dan_williams | last post by:
I have the following test web page:- <html> <head><title>Test</title> <script language="Javascript"> <!-- function fnTR() { alert("TR"); }
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.