Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何将TextBox\u Textchanged事件与正则表达式一起用于RequiredField控件_C#_Asp.net_Webforms - Fatal编程技术网

C# 如何将TextBox\u Textchanged事件与正则表达式一起用于RequiredField控件

C# 如何将TextBox\u Textchanged事件与正则表达式一起用于RequiredField控件,c#,asp.net,webforms,C#,Asp.net,Webforms,文本框与两个RequiredField验证器关联 此文本框还包含TextChanged事件。 我想允许首先执行RequiredField验证器,然后执行Textchanged事件 protected void TextBox1_TextChanged(object sender, EventArgs e) { if (!System.Text.RegularExpressions.Regex.IsMatch(TextBox1.Text,Regular_Expression)) {

文本框与两个RequiredField验证器关联 此文本框还包含TextChanged事件。 我想允许首先执行RequiredField验证器,然后执行Textchanged事件

protected void TextBox1_TextChanged(object sender, EventArgs e)
{
    if (!System.Text.RegularExpressions.Regex.IsMatch(TextBox1.Text,Regular_Expression))
    {
        Label2.Text = "from textChanged.";
    }
}

if (!System.Text.RegularExpressions.Regex.IsMatch(TextBox1.Text,Regular_Expression))
这里如何将正则表达式与(
requiredfield
regularExpression
控件)一起使用

有人能帮我如何使用文本框中的RequiredField控件吗? 实际上,这个脚本是为了首先验证所需的字段控件,然后执行textbox\u Textchanged事件。因为在textbox中填充值时的移动,textbox更改事件正在触发,所以OOB(开箱即用)控件未正确执行。要执行textbox required Field OOB控件,如果值有效,则应执行
textbox\u TextChanged
事件。只是在谷歌上搜索并找到
Regex.IsMatch(文本框,正则表达式)
但不知道如何使用正则表达式
表达式。

这不是ASP.NET核心。它看起来像Web表单,但很难说。检查问题上的标签,只添加与问题相关的内容。这不是ASP.NET核心。它看起来像Web表单,但很难说。检查问题标签,只添加与问题相关的内容。