Ramco Ramco

Ramco Ramco

  • 437
  • 3.4k
  • 548.1k

error message display

Aug 28 2024 7:26 AM

Hi

  I have below code . When i leave Blank it shows message like the image attached.

When Regular expression is executed it display error message other way. Image attached.

I want message to be displayed in both cases similar to Image 2.

<div class="col-lg-6 col-md-6 col-sm-12">
                                            <div class="form-group">
                                                <label>Bank Name</label>&nbsp;<span style="color: red">*</span>
                                                <asp:TextBox ID="txtBankName" MinLength="2" MaxLength="50" class="form-control alpha" placeholder="Bank Name" required="true" runat="server"></asp:TextBox>
                                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtBankName"
                                                ForeColor="Red" ValidationExpression="[a-zA-Z0-9\s]*$" ErrorMessage="Valid characters: Alphabets, Numbers and Space." />
                                            </div>
                                        </div>

Thanks


Answers (3)