Redirection in a Page with Validation Objects

I’ve been up to a new C# with ASP.NET project lately, and I plan to record down the problems occurred along the development, of course, with solutions.

Here is the first one, about Redirection and Validation. It’s pretty simple, or, I should say amateur. You got it, amateur is who I am. ^^

I encountered this problem that, Okay, here comes the

Problem Description

I’ve got a Button object with OnClick Event in page1, which, when clicked, Response.Redirect to page2. Meanwhile, I have some Validator objects in page1, too. The thing is, the client-side Validation occurs before even reaching the Event for the Button. That is to say, the Validators prevent Redirection from happening.

Solution

You’ll love this because it’s so easy. In the Button’s properties list, find "CausesValidation" and set it to false. That’s it.

My thought is, there’s always some property control if an operation is generated on the server-side.

作者:Keefe Dunn

a dreamer, a learner, a lawful beginner.

1条评论

发表评论

您的电子邮箱地址不会被公开。