I've seen many a forum and blog entries that look like the title of this entry. I was frantically trying to find the solution for this a few hours ago and found a lot of questions of the same type, most of them abruptly ending into nothing. No solution, only the questions. What was I to do? Debug!

The problem was that buttons with __doPostBack seemed to work and those with WebForm_DoPostBackWithOptions did not. I pressed them and nothing happened.

Debugging the hell out of the two javascript functions (both used by NET 2.0, on who knows what conditions) I realized that the problem was not in the javascript functions! The problem was a false one.

The real problem is in the validators. If you have a validator on a field and the field has some wrong values in it and both field and validators are hidden, the submit will not work and you will not see what the problem is. Let me make this simple: if you have problems with submit buttons that seem not to work, check your validators!

Now, why the field was hidden and its values filled and the validator enabled is a problem, but that I can fix easily. The "Oh, I am so stupid" phenomenon probably stopped a lot of people posting the solution after they found it.

Comments

Siderite

Thank you for clarifying your problem and solution.

Siderite

mfo

Thanks! If you have multiple buttons and only *one* should cause the validation, then specify ValidationGroup property for the validators and for the button with the same group value provided. More Info: https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.button.validationgroup?view=netframework-4.8 (ValidationGroup property for Button). https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.basevalidator.validationgroup?view=netframework-4.8 (ValidationGroup property for Validator) Hope this might be helpful for someone.

mfo

Micro-BIOS

Yay! 2019 and this is still useful! Thanks you guy.

Micro-BIOS

Custos

Your post is still saving asses almost a decade after it was posted.

Custos

Rajiv

Thanks for sharing it. I wasted almost two entire days looking for a solution for this.

Rajiv

Anonymous

Thanks At last find Solution on Your blog after 2 hours searching God Bless You Imran Ullah Khan Pakistan

Anonymous

Anonymous

Man you saved me few hours of work, Thanks!!

Anonymous

Al

At last!! Adding CausesValidation="false" to my link buttons solved my problem too. Cheers.

Al

Tim Hong

Awesome Help. Knowledge always worth to share! Thank you very much!

Tim Hong

Bruno Monteiro

Thank you dude. Now, my buttons are CauseValidation = false. ;)

Bruno Monteiro

Siderite

Why are you doing software development if you are not a software person? There isn't much I can say outside of what is in the post. You should look for ASP.Net controls that end in "Validator" somewhere in the aspx, ascx or maybe instantiated in the code. A control that contains those validators or even an html container that are hidden via styling is what is wrong with your page. A validator control is always associated with an input control, like a textbox or text input or checkbox, radio button, select, etc. To check this from the browser, rather than from within the code, use a DOM inspector (all major browsers have one included nowadays) and look for hidden container elements. Make them show (by removing the display:none style attribute) and maybe you will see the validator that is throwing the error and stopping you from doing a postback.

Siderite

Anonymous

OOOPSSS sorrryyyy!! if i was rude but was in hurry and yes i really dont get it because m not a software person as u said a software ill :P. I have to fill up a webform but the SAVE button is not active and my work is getting late day by day and i literally dont know how to resolve this problem. If u cud help me through this i'll be reallyyy thankful to you :)

Anonymous

Siderite

Dear Anonymous, I thought long and hard before answering, oscillating between swear words, insults and blaming you and your kind for all software ills to the desire to actually help you, even if you seem unable to even ask for it in a decent way. But I think the best possible answer is a classic: http://lmgtfy.com/?q=ASP.Net+Validator

Siderite

Anonymous

i am having the same problem and still dont get whatever u ppl are saying :( what is a validatr?? whr to find it?? where to put this causes validation thing???

Anonymous

Nick Pearce

Still a life saver 5 years on... thank you.

Nick Pearce

Anonymous

Thanks. You save my day!! Explained in simple terms.

Anonymous

Anonymous

Thank you - after two hours, this fixed my issue.

Anonymous

Anonymous

thanks, it's really helped me. great article.

Anonymous

Anonymous

Great work! This appears to have fixed a problem with controls assigned as triggers to an update panel which randomly stop working (__postback function). In my case, I would often leave the page and do some work, come back to the site only to find the controls no longer functioning. I have now added causesvalidation="false" to all of my controls hooked up as triggers to an updatepanel.

Anonymous

Anonymous

Perfect, after two days of googling this was a breath of fresh air. You saved me!!!

Anonymous

Anonymous

Thank's this was what I searched for

Anonymous

Padma

you are doing a great things to the world of developers.thanks a lot for ur articles and solutions to bugs (especially for ajax related javascript errors hats off to you and ur talent.) very happy in greeting you. wish you all success in your endeavours.Great thanks to you

Padma

Scott

Thanks a million! I had disabled (enabled=false) my validators in a user control. I would have never found this.

Scott

neeva

Thankyou so much .. I was facing the same problem ..your post saved me a lot of time ..

neeva

Anonymous

Thanks dude, as everybody else has said, this saved me hours of useless research time that I would have spent.

Anonymous

DJ

I had the LinkButton only worked once problem. Added CausesValidation="false", now works like a charm. Thanks Rowan

DJ

Massimo

Thanks for your post! I had spent a lot of time on that problem... Thanks to rowan, too.. I had the same problem.. quote: " rowan said... I had the same problem using LinkButtons. If you clicked on the link twice or more in IE 6 then the links would stop working. I was able to fix it by adding this to the LinkButton tag: CausesValidation="false" "

Massimo

Anonymous

This post has just save me from pulling my hair. I had CommandField in a GridView but when you edit a press update nothing happens and have wasted a lot of hours trying to figure it out. After setting CausesValidation="false" it is working ok!!. Many thanks

Anonymous

Josh Gough

Thank you!! I had neglected to add a validation summary to my page so my control, which was bubbling up errors to the page had nowhere to display them. All the errors displayed inline, but clicking Submit did nothing to highlight this fact.

Josh Gough

Siderite

Ok. The solution is to find out which validator causes the problem. You should know that if you made the page and all, since you are the one putting validators there. But let's assume that you don't know what is going on. The best solution is to see what the Page_Validators array contains (in Javascript) and what is their controltovalidate value. Something like *_javascript:alert(Page_Validators[0].controltovalidate);_* in your browser address bar should do the trick to show you the control that the first validator (if any) is trying to validate. The property might be controlToValidate, I am not sure about the casing and I am too tired to test it out.

Siderite

Anonymous

I had the same problem with the Finish button in the Wizard. I change to using Panels instead and still had the same problem. CausesValidation=false worked for me. What's up with that? Thanks again.

Anonymous

Anonymous

You're a life saver, I've been racking my brain (and the net) for hours trying to figure it out... Damn Microsoft they couldn't have made this one easy...

Anonymous

takejiro

thank God for this!! i've been googling for hours on how to solve this. CausesValidation=false did it for me. life saver!!

takejiro

rowan

I had the same problem using LinkButtons. If you clicked on the link twice or more in IE 6 then the links would stop working. I was able to fix it by adding this to the LinkButton tag: CausesValidation="false"

rowan

Anonymous

Thanks, you really saved my bacon with that one!

Anonymous

Post a comment