标签: validator

  • 在带有 Validator 对象的页面进行 Response.Redirect 转向

    由于客户端 Validation 触发在 Button 的事件之前,所以如果在事件里定义转向的话,会被 Validator 们阻止。
    其实解决办法也很简单,将 Button 的 CausesValidation 属性设置为 false 即可。
    我的想法是,由服务器端生成的操作,都有相应的属性可以对其进行控制。呃,仅仅是想法。

    For a detailed English version of this article, please visit:
    http://dengkefu.com/boke/programming/c-sharp-and-dot-net/redirection-in-a-page-with-validation-objects.html

  • 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.