tags:

views:

10

answers:

1

Hello, a minor question but it's driving me nuts. I'm programatically generating about 50 DDLs based on a database schema (i.e. item 1 can do a,b,c item 2 can do d, e, a, etc etc).

If I was just writing the markup, I could specify:

asp:DropDownList OnSelectedIndexChanged="funTimes"

and be done with it, unfortunately, I'm just not sure how to set that programatically. I found a "SelectedIndexChanged" event, but I'm not sure what I need to return in terms of an event handler when all I want to do is set the method called. I realize I could write 50 methods:

ddl1_SelectedIndexChanged() ddl2_SelectedIndexChanged() etc etc

but that solution isn't terribly flexible, especially when I really only want the same method called. Is there a good way to accomplish what I'm trying to do here? Any input is greatly appreciated. Thanks.

+1  A: 

You can set it from your code behind

DropDownList1.SelectedIndexChanged += new EventHandler ( funTimes ); 

You can set this from the Page_Load EventHandler or even from within the funTimes EventHandler.

rockinthesixstring
You rock my socks. Sorry I wasn't seeing the obvious tonight, I really really appreciate the reply.
Dio
please click the checkbox if this was helpful. (I don't think you can upvote with your rep)
rockinthesixstring
Yup, sorry it actually makes me wait a few minutes before I click the accept ;)
Dio
no worries... thanks
rockinthesixstring