views:

265

answers:

1

Hi,

I need to add the OnClick event to asp:DropDownList control, due to the existing events don't satisfy my current needs.

Is it possible to achieve this?

Thank you very much.

+1  A: 

What reason do you have for wanting an OnClick event on the DropDownList control? If you were to implement an OnClick server-side event on the DropDownList the user would never be able to select any of the list items. This is because in order to fire a Server-Side OnClick, a postback would be required. I.e. the user would click the DropDownList, a postback would instantly occur and they wouldn't be able to select a value.

It sounds like a case of trying to fix the wrong problem, however you could probably try and use the "onclick" JavaScript attribute and handle whatever you're trying to do using client side script and AJAX?

GenericTypeTea
I'm passing values from a parent to a child web form via javascript. In child form I load the values passed, but one of them will become in a dropdonwlist in child form. When in child form the Page_Load event is executed for first time I still don't know the value of the javascript variables due to are the last piece of code executed. Finally, in child form I want to be able to load new list items to the drop down list when the user clicks on it based with the value which already is there. The other events present in dropdowlist (as for example OnSelectedIndexChanged) are not useful.Thanks
Why are OnSelectedIndexChanged or OnSelectedValueChanged not useful? You can change the DataSource of the DropDownList from those events?
GenericTypeTea