We help IT Professionals succeed at work.

Calling a function from dropdownlist

rowmark asked
Last Modified: 2008-01-09
I have 4 dropdownboxes ddlfilter1,ddlfilter2,ddlfilter3,ddlfilter4 in my ASPX page.

I have a function in C# which will accept selectedvalue of the dropdown and dropdownlist name and do some return adds some controls based on the selected values.

protected void generatecontrols(dropdownlist dd,string columnName)


Now how do I call my generatecontrols function from the dropdownlist

something like

<asp:dropdownlist ID='ddlfilter1' runat=server onselectedchange="generatecontrols(this,this.selectedvalue);"/>

Please help
Watch Question

hi rowmark,
 you can give a call to the generatecontrols(dropdownlist dd,string columnName) function on the seleced index change event of the drop down lists.

 you can call the function as
  generatecontrols(dropdownlist1, dropdownlist1.SelectedValue);

Individual Contributor, Software Architect
This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.