customvalidator servervalidate参数说明

发布于 2024-08-03 02:48:52 字数 107 浏览 2 评论 0原文

CustomValidator 的 ServerValidate 事件有 2 个参数:source 和 args。

他们每个人都指出了什么?请对它们进行任何描述。

谢谢

The ServerValidate event of CustomValidator has 2 parameters: source and args.

What each of them point out to? Any description of them please.

Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

时光暖心i 2024-08-10 02:48:52

与所有“EventHandler”样式事件一样,source 将引用引发事件的对象(在本例中为 CustomValidator 实例)和 < code>args 将引用与此特定事件关联的事件数据。

对于 ServerValidate eventargs 参数的类型为 ServerValidateEventArgs。它有两个重要的属性:

  • :返回您正在验证的输入控件的值(例如文本框中的文本。)
  • IsValid:如果验证是,则将此属性设置为 true成功则为 false 如果未成功。

Like all "EventHandler"-style events, source will refer to the object that raised the event (in this case the CustomValidator instance) and args will refer to event data associated to this specific event.

For ServerValidate event, the args parameter is of type ServerValidateEventArgs. It has two important properties:

  • Value: returns the value of the input control you're validating (e.g. text in the textbox.)
  • IsValid: you set this property to true if the validation is successful and false if it's not.
白衬杉格子梦 2024-08-10 02:48:52

参数 source 是验证器控件的引用,args 表示事件特定数据。

protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
    if (args.Value != "OK")
    {
        args.IsValid = false;
    }
}

Argument source is reference of validator control and args represent event specific data.

protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
    if (args.Value != "OK")
    {
        args.IsValid = false;
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文