I have a dropdown box on a custom webpart and I am initially filling it out with server side c# code in the createchildcontrols section. I wanted to cascade the dropdown to fill out another dropdown. This works fine if I do it all in .Net except the annoying postback refresh of the entire form which the customer does not like. I know how to achieve the same effect using jQuery and attaching an onchange event. This does fill out the second dropdown without an issue. However, if I do this with jQuery my button event on the form no longer fires and I can not save the data. Has anyone else seen this or am I missing some setting that will allow this to occur?

UPDATE: 3/12/2010 Okay, so I still have the issue, but what I have done is actually proved that the button click does fire, but it does a postback and does not actually run the code for the button click event. So I get a postback which I tested and know that the request object is working. This is not what I want to do as the controls are no longer available and the button event is what I wanted to actually use to read the controls and validate and then add to the list. If I go back to pure asp.net and do not use the jQuery, it all works fine.

  • Have you debugged the script with Firebug or IE Dev Tools? - Where was the error thrown? Mar 11, 2010 at 19:26
  • I can not use Firebug as we are not allowed to have it :( The javascript and jQuery work fine. The asp button click stops working when I use this method but works fine as soon as I remove the jQuery Mar 11, 2010 at 19:28
  • @spevilgenius: Not allowed to use Firebug? Wow that hurts. Is Google Chrome an option?
    – Alex Angas
    Mar 11, 2010 at 22:25
  • No it is not :( This is running on a dev box not connected to the internet in a virtual machine setup. I am not sure what those tools will tell me. The jQuery works just fine. When removed, the asp button click works fine. I do not understand where the breakdown occurs. Mar 11, 2010 at 22:42

4 Answers 4


It probably depends on what you are doing with your jQuery. If the save button doesn't fire at all, then somehow you must be breaking the click event. Make sure that your selectors are specific enough.

  • The save button does fire, but it does a normal postback instead of running the event attached to button. This means the page itself refeshes and of course all of the controls are gone. Mar 15, 2010 at 17:59

How are you attaching the JQuery code to the event on the drop down list? As Marc says you are probably doing something here which breaks the .Net post back model.

Do you get any js errors when you click your button?

  • There are no error in javascript. I am attaching a javascript event from the server code using the format: ddFaoa.Attributes.Add("OnChange", "cascade('" + ddFaoa.ClientID.ToString() " "')"); The event has more info but you get the idea. This works fine, but as Marc correctly guessed the click event of the button does not fire when I do this. Mar 11, 2010 at 15:37

I had an issue similar to this.... Whenever I tried to manipulate an asp:DropDownList through javascript/jquery, asp.net would throw a client validation error. I ended up using System.Web.UI.HtmlControls.HtmlSelect instead of a asp:DropDownList and that fixed the problem.

Its weird that you are not even getting an error message...

  • This sounds promising. I will have to try it on Monday. Mar 13, 2010 at 8:37
  • This did not work either. I think that there are too many variables for me to figure out what is going on. Mar 15, 2010 at 17:57

Unfortunately for me there were too many problems to really iron out exactly what was going on so I chose a different route to build the form due to time constraints. However, I wanted to at least mention the form that I had most likely had issues because of all the things I was trying to do without possibly understanding what was really happening. I tried to create a webpart form that had tabs and I was using the jQuery UI to do this. I was breaking the form controls onto different tabs and I had about 20 to 25 controls including 3 rich text editors. I also used a jQuery UI dialog to display the form and even tried to be sure it was attached to the form and not the body. A lot of these controls lost a lot of functionality when they were done this way and there are so many things that just did not work based on what I was doing to draw the controls on the screen. So on my next attempt at getting this to work, I am going to try modifying a data form webpart to see if I can get this to do what I want. The customer wanted to have a smaller tabbed form, because for whatever reason, they did not like having the dropdown choice for content types to split the form that way. I will have to see if this works and will write up my results.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.