Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey all,

I am facing problem in Ajax FilteredTextBoxExtender.

Here is my sample code
Textbox
XML
<asp:TextBox ID="txthdrRemarks" runat="server"  CssClass="textBox" TextMode="MultiLine"
                   Width="400px"></asp:TextBox>


Ajax FilteredTextBoxExtender
XML
<ajaxToolkit:FilteredTextBoxExtender ID=&quot;Filteredtextboxextender1&quot; runat=&quot;server&quot; FilterType=&quot;Custom, Numbers, UppercaseLetters, LowercaseLetters&quot;
    TargetControlID=&quot;txthdrRemarks&quot; ValidChars=&quot;a-z/-\.,!@#$%^&amp;*()+|~&lt;&gt;;:&#39;{}[]-?> </ajaxToolkit:FilteredTextBoxExtender>



When ever i write in taxtbox its working fine. but when i press "Enter Key"
its not working.
Please help me..

Regards
Rikin
Posted
Comments
VICK 22-May-13 6:44am    
It seems from the above code that You are allowing any type of data in your text box,, and if it is so,, than what is the need of Extender here???? :(

You should add the "Enter Key" to your valid chars as well.

C#
protected void Page_Load(object sender, EventArgs e)
{
    FilteredTextBoxExtender1.ValidChars = FilteredTextBoxExtender1.ValidChars + "\r\n";
}


==OR==

You can write your own extender. Have a look at this link.[^]

Good luck,
OI
 
Share this answer
 
v2
Put this its working 100%. It restricts invalid characters and accepts enter too...


XML
<cc1:FilteredTextBoxExtender ID="txtRemark_FilteredTextBoxExtender" runat="server" Enabled="True"
                                                    FilterMode="InvalidChars" InvalidChars="~!@$#%^&amp;*_+{}=,;[]\/':`|&nbsp;&lt;&gt;&quot;?"
                                                    TargetControlID="txtRemark">
                                                </cc1:FilteredTextBoxExtender>
 
Share this answer
 
Dear OI,
Thanx a lot for suggestion.
I tried that one but not working at all..
when i press enter key it automatically come back to previous line. :(

I cant understand what's problem..
 
Share this answer
 

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