开发者

Can I prevent RequiredFieldValidation from triggering against postbacks from a specific control

I have a web form with a number of textbox controls which I've associated RequiredFieldValidator's with. I have a ValidationSummary control 开发者_StackOverflow社区on the page to render any incomplete fields when I submit the page.

However, I've just had to add an image upload facility to the same page, and have an 'Upload' button which I have posting back to perform the upload. I don't want this upload button to trigger the RequiredFieldValidators for the rest of the page though - I want this upload postback to be ignored as far as the validation goes.

What's the best way to stop the RequiredFieldValidator's from firing when I submit this upload button on the page because at the moment, the upload won't occur unless I have first filled out all of the other textbox controls on the page.


set CausesValidation="false" on the image upload button

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.causesvalidation.aspx


give a common validation group name to all validation control and assign the same group name to the control which is validating all those textboxes and don't set validation group property of that upload button

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜