471,334 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,334 software developers and data experts.

Textbox validation asp.net

I have the following textbox in the footer of a Datagrid and I'd like to try
and add some client side code too take out all the spaces which the user
might enter by accident. The textbox is used to enter forename text so
basically I need the code to strip out any spaces a user may enter. At the
moment I have two validators and my html code looks as follows: -
Can someone help me enter the code I need to achieve this.
Thanks very much for your help

<FooterTemplate>
<asp:TextBox ID="add_Forename" Columns="5" Runat="Server" />

<asp:RequiredFieldValidator id="rvForename" runat="server" ErrorMessage="A
Forename is required" ControlToValidate="add_Forename"
Font-Size="Small">*
</asp:RequiredFieldValidator>

<asp:regularexpressionvalidator id="revlLengthLetter" ForeColor="Red"
Font-Size="Small" runat="server" ErrorMessage="Forename must be more than 2
and less than 25 characters and has to be a letter"
ControlToValidate="add_Forename" ValidationExpression="^[A-Za-z]{2,25}$">*
</asp:regularexpressionvalidator>
</FooterTemplate>
Jul 21 '05 #1
0 789

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Pham Nguyen | last post: by
2 posts views Thread by Oleg Ogurok | last post: by
1 post views Thread by bsm | last post: by
2 posts views Thread by Christian Cambier | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.