0

Hi peoples,

I have a textbox:

<asp:TextBox 
     ID="TextBoxFirstName" 
     runat="server">
</asp:TextBox>

I need to make sure that it captures data for a first name allowing letters from a-z, A-Z and special characters like - (dash) and the space characters. The validator will block all other characters. How do I go about doing this using VB (if possible).

Cheers

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by chithrasujith
0
<asp:TextBox ID="txtName" runat="server"/>
    <asp:Button ID="btnSubmit" runat="server" Text="Submit" />
    <asp:RegularExpressionValidator ID="regexpName" runat="server"     
                                    ErrorMessage="This expression does not validate." 
                                    ControlToValidate="txtName"     
                                    ValidationExpression="^[a-zA-Z'(.|_|' ')\s]{1,40}$" />
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.