Page.IsValid 是在 Page_Load 发生之后才会处理
所以在 Page_Load 中调用它是无用的
应该在 OnClick , OnSelectedIndexChanged 这类的服务器控件事件中调用

 

Page.IsValid 属性
获取一个值,该值指示页验证是否成功。
sample:
void ValidateBtn_Click(Object Sender, EventArgs E) {

    if (Page.IsValid == true) {
      lblOutput.Text = "Page is Valid!";
    }
    else {
      lblOutput.Text = "Some of the required fields are empty.";
    }
}

相关文章:

  • 2021-05-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-06
  • 2021-08-14
  • 2022-12-23
  • 2021-08-19
  • 2021-05-13
猜你喜欢
  • 2022-02-08
  • 2021-09-25
  • 2021-10-06
  • 2021-10-27
  • 2022-12-23
  • 2022-01-20
相关资源
相似解决方案