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.


已发布

分类

来自

评论

《“Redirection in a Page with Validation Objects”》 有 1 条评论

  1. Ramu 的头像
    Ramu

    Thanks

回复 Ramu 取消回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注