Last post Aug 20, 2010 10:58 AM by MikeMackey
Feb 16, 2010 10:41 AM|MikeMackey|LINK
Hi, so I have a control that is created in the code behind and generates fine but I can't figure out how to create an event handler for it. I've found plenty of examples for it in C sharp, but none of them seem to apply to VB. What I want to do is essentially
myDropDownList.SelectedIndexChanged = "Event to do here"
but it doesn't seem to work for me.
Any suggestions are appreciated.
Feb 16, 2010 12:25 PM|MetalAsp.Net|LINK
Not a VB person, but it looks like you need to use Addhandler.
Feb 16, 2010 12:41 PM|MikeMackey|LINK
Yup I found out about 5 minutes after I posted this that I had been looking in the wrong direction for how to make ti work, thanks for your reply though.
Aug 19, 2010 11:57 PM|MikeMackey|LINK
It's been a while, but I believe when you create a drop down programmatically you need to create it's events programmatically as well. If it's important to you I could check my code at work to see exactly what I did.
Aug 20, 2010 10:58 AM|MikeMackey|LINK
What I ended up doing was this:
Protected templist As New System.Web.UI.WebControls.DropDownList
AddHandler templist.SelectedIndexChanged, AddressOf templistClicked