Click here to Skip to main content
15,914,071 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys!

I am wondering why my text box do not accept any special characters such hyphen or even a space? Here is my code:
ASP.NET
<td class="auto-style9" colspan="3" style="vertical-align: top;">
<asp:TextBox ID="txtmilestone_name" runat="server" Width="408px"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1"  runat="server" FilterType="LowercaseLetters, UppercaseLetters" TargetControlID="txtmilestone_name" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtmilestone_name" ErrorMessage="Milestone name field required!" ForeColor="Red" ValidationGroup="m_add_validation">*</asp:RequiredFieldValidator>
</td>

Please help me :)
Posted
Updated 16-Sep-14 16:03pm
v3
Comments
George Jonsson 16-Sep-14 21:52pm    
Please reformat your code so it becomes readable.

1 solution

Your FilteredTextBoxExtender will only allow you to enter alphabets. In order for you to allow it to enter special characters you will have to set the filter type to custom and change the code as follows.
ASP.NET
<table><tbody><tr><td class="auto-style9" colspan="3" style="vertical-align: top;">
<asp:textbox id="txtmilestone_name" runat="server" width="408px" xmlns:asp="#unknown"></asp:textbox>
<cc1:filteredtextboxextender id="FilteredTextBoxExtender1" runat="server" filtertype="LowercaseLetters, UppercaseLetters, Custom" validchars="!~@-" targetcontrolid="txtmilestone_name" xmlns:cc1="#unknown" />
<asp:requiredfieldvalidator id="RequiredFieldValidator1" runat="server" controltovalidate="txtmilestone_name" errormessage="Milestone name field required!" forecolor="Red" validationgroup="m_add_validation" xmlns:asp="#unknown">*</asp:requiredfieldvalidator>
</td></tr></tbody></table>
 
Share this answer
 
Comments
DarkDreamer08 17-Sep-14 1:20am    
Thank you so much! It works GREAT!!!!! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900