0

I have tried the following in SelectedIndexChanged method:

if(ddl.SelectedValue == "option"){
    myFunc();
}

if(ddl.SelectedValue == "option"){
    Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","myFunc()",true);
}

Second method gave me a function undefined error

  • I am working with asp.net and have added a method that executes when someone selects an option from the drop down. I want to call a js function once I select a particular option. I havent used a select control at all. – kiranmai malla Apr 14 '20 at 10:49
  • Could you please append this information and whatever you think might be helpful to your question? Also I think you should provide the javascript method. Where fo you get undefined? We can tell that you used this -> https://stackoverflow.com/questions/5731224/calling-javascript-function-from-codebehind. But not really have much info about your whole code scope, to give you a full answer. – panoskarajohn Apr 14 '20 at 10:54
  • This is the dropdown control: . It has some list items in it. When a particular list item is selected, I want to call a js function from the "method_name" method(code behind file) which i have written in the .aspx file in the – kiranmai malla Apr 14 '20 at 11:07

0 Answers0