Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8932899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:24:39+00:00 2026-06-15T09:24:39+00:00

I am using RegularExpressionValidator for validating email id for a particular company. This one:

  • 0

I am using RegularExpressionValidator for validating email id for a particular company. This one:

ValidationExpression=\\w+([-+.']\\w+)*@ABCCompany.com 

is working for only first email id, i need to validate more than one email. I found another one online :

ValidationExpression="((\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*([;])*)*"

It’s working fine but i have to validate for ABCCompany.com. I tried also CustomValidator server side validation and it’s working code wise but its not showing an error message.

Can anybody please help me to solve my problem.

My HTML Code:

<

telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" CellPadding="0"  CellSpacing="0" GridLines="None" HorizontalAlign="Left" ShowFooter="true" AllowPaging="true"  PageSize="10" AllowMultiRowSelection="true" OnItemCommand="RadGrid1_OnItemCommand" OnNeedDataSource="RadGrid1_OnNeedDataSource" OnInsertCommand="RadGrid1_OnInsertCommand" OnUpdateCommand="RadGrid1_OnUpdateCommand" OnDeleteCommand="RadGrid1_OnDeleteCommand"  AllowSorting="true"> 

 <PagerStyle Position="Bottom" AlwaysVisible="true" /> 

 <ValidationSettings EnableValidation="true" ValidationGroup="products" /> 

<MasterTableView CommandItemDisplay="Top" HorizontalAlign="NotSet" AutoGenerateColumns="False" DataKeyNames="id"> 

 <Columns> 
<telerik:GridTemplateColumn DataField="Product_ID" FilterControlAltText="Filter Product_ID column" HeaderText="Product_ID" UniqueName="Product_ID" SortExpression="Product_ID"> 

<HeaderStyle HorizontalAlign="Center" /> 

<ItemStyle HorizontalAlign="Center" /> 

<ItemTemplate> 

<asp:Label ID="lblProduct_ID" runat="server" Text='<%# Bind("Product_ID") %>'></asp:Label> 

</ItemTemplate> 

</telerik:GridTemplateColumn> 

<telerik:GridTemplateColumn DataField="Product_Email" FilterControlAltText="Filter Product_Email column" 

HeaderText="Product Email" UniqueName="Product_Email" SortExpression="Product_Email"> 

<HeaderStyle HorizontalAlign="Left" /> 

<ItemStyle HorizontalAlign="Left" /> 

<ItemTemplate> 

<asp:Label ID="lblProduct_Email" runat="server" Text='<%# Bind("Product_Email") %>'></asp:Label> 

</ItemTemplate> 

<EditItemTemplate> 

<asp:TextBox ID="tbProduct_Email" runat="server" Text='<%# Bind("Product_Email") %>' 

Width="500px"></asp:TextBox>&nbsp;(Note: Enter multiple emails with ; separator) 

<asp:RequiredFieldValidator ID="rfvtbProduct_Email" runat="server" ControlToValidate="tbProduct_Email" 

ErrorMessage="Please enter Product Email" ForeColor="Red" ValidationGroup="products"></asp:RequiredFieldValidator>  

<asp:CustomValidator ID="cvtbProduct_Email" runat="server" ControlToValidate="tbProduct_Email" 

ForeColor="Red" ErrorMessage="Enter only valid ABCCompany Emails" OnServerValidate="cvtbProduct_Email_OnServerValidate" 

ValidationGroup="products" EnableClientScript="false" Display="None"></asp:CustomValidator> 

</EditItemTemplate> 

</telerik:GridTemplateColumn> 

<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> 

<ItemStyle HorizontalAlign="Center"></ItemStyle> 

</telerik:GridEditCommandColumn> 

<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" Text="Delete" 

UniqueName="DeleteColumn"> 

<ItemStyle HorizontalAlign="Center"></ItemStyle> 

</telerik:GridButtonColumn> 

</Columns> 

<EditFormSettings ColumnNumber="1" CaptionDataField="Product_id" CaptionFormatString="Edit properties of Product ID: {0}"  InsertCaption="Product ID:"> 

</EditFormSettings> 

</MasterTableView> 

<ClientSettings EnableRowHoverStyle="true"> 

</ClientSettings> 

</telerik:RadGrid>

Server-side validation Code:

    protected void cvtbProduct_Email_OnServerValidate(object sender, ServerValidateEventArgs args)
    {
        bool valid;

        var email = new string[100];

        var emailList = (TextBox) RadGrid1.MasterTableView.GetInsertItem().FindControl("Product_Email");

        if (emailList.Text != "")
        {
            if (emailList.Text.Contains(";"))

                email = emailList.Text.Split(';');

            else

                email[0] = emailList.Text;

            for (var i = 0; i < email.Length; i++)
            {
                if (email[i] != null)
                {
                    valid = Regex.IsMatch(email[i], "\\w+([-+.']\\w+)*@ABCCompany.com");

                    if (!valid)
                    {
                        args.IsValid = false;
                    }

                    else

                        args.IsValid = true;
                }
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:24:40+00:00Added an answer on June 15, 2026 at 9:24 am
        protected void cvtbProduct_Email_OnServerValidate(object sender, ServerValidateEventArgs args)
        {
            var emailList = (TextBox) RadGrid1.MasterTableView.GetInsertItem().FindControl("Product_Email");
    
            if (string.IsNullOrEmpty(emailList.Text))
            {
                args.IsValid = false;
                return;
            }
    
            //you don't need to check if it has the seperator in it
            var emails = emailList.Text.Split(';');
    
            foreach (var email in emails)
            {
                //the @ before a string removes the need to double up on '\'
                //you were missing a '\' before the .
                var valid = Regex.IsMatch(email, @"\w+([-+.']\w+)*@ABCCompany\.com");
    
                if (!valid)
                {
                    args.IsValid = false;
                    return; //don't check anymore
                }
            }
    
            //all must have passed
            args.IsValid = true;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using CI for the first time and i'm smashing my head with this seemingly
I am using RegularExpressionValidator to validate multiple email addresses seprated by a comma ,
I'm using the ASP.NET RegularExpressionValidator I need a regular expression to keep users who
I am using RegularExpressionValidator, for which i need the expression for the input having
I am using Asp.Net/C# .I am using RegularExpressionValidator control for validating my password textbox
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
I am using the following regular expression on my regular expression validator <asp:RegularExpressionValidator ID=revAddress
I developed a screen in which there are fields like first name,username,password and email.
I have a regex that I am using in an asp.net RegularExpressionValidator to check
I am having problems using a ASP.NET Regular Expression Validator on text boxes. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.