Hi all,
I have 2 problems to solve.
1. I am trying to filter a rad textbox in client side. I need to restrict special characters in it. Is there any control like FilteredTextBoxExtender to filter rad textbox ?
I am really fed up with this.Please provide me a solution for this.
thanks
Abhi
                                I have 2 problems to solve.
1. I am trying to filter a rad textbox in client side. I need to restrict special characters in it. Is there any control like FilteredTextBoxExtender to filter rad textbox ?
I am really fed up with this.Please provide me a solution for this.
thanks
Abhi
9 Answers, 1 is accepted
0
                                
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                 Rank 2
                Rank 2
            
    
                                                
                                                answered on 22 Aug 2012, 11:24 AM
                                            
                                        Hi,
One suggestion is that you can check for regular expression in OnKeyPress event.
JS:
Thanks,
Shinu.
                                        One suggestion is that you can check for regular expression in OnKeyPress event.
JS:
function OnKeyPress(sender, eventArgs) {   var char = eventArgs.get_keyCharacter();   var exp = /[^a-zA-Z0-9-]/g;   if (exp.test(char))   {    eventArgs.set_cancel(true);   }}Thanks,
Shinu.
0
                                
                                                    Abhi
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 22 Aug 2012, 12:52 PM
                                            
                                        HI,
Thanks for your suggestion. But this
thanks
abhi
                                        Thanks for your suggestion. But this
OnKeyPress event have some browser compatibility issue. Can we use FilteredTextBoxExtender like control to filter rad textbox.thanks
abhi
0
                                Hi Abhi,
The FilteredTextBoxExtender can't be used for RadInputControls it can be applied on asp:TextBoxes.
Regards,
Vasil
the Telerik team
                                        The FilteredTextBoxExtender can't be used for RadInputControls it can be applied on asp:TextBoxes.
Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
                                
                                                    Abhi
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 07 Sep 2012, 05:32 AM
                                            
                                        Hi Vasil,
Then how can i restrict special characters in RadTextBox on key press event . Please provide me solution please.
Thanks
Abhi
                                        Then how can i restrict special characters in RadTextBox on key press event . Please provide me solution please.
Thanks
Abhi
0
                                
                                                    Shinu
                                                    
                                            
    Top achievements
    
            
                 Rank 2
                Rank 2
            
    
                                                
                                                answered on 07 Sep 2012, 09:24 AM
                                            
                                        Hi,
Try the following javascript to allow only alphabets in RadTextBox.
JS:
Also check the following help documentation which explains more about this.
OnKeyPress.
Thanks,
Shinu.
                                        Try the following javascript to allow only alphabets in RadTextBox.
JS:
function OnKeyPress(sender, eventArgs)    {        var c = eventArgs.get_keyCode();        if ((c < 65) || (c > 90 && c < 97) || (c > 122))            eventArgs.set_cancel(true);    }OnKeyPress.
Thanks,
Shinu.
0
                                
                                                    Sharmin
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 26 Nov 2012, 05:16 PM
                                            
                                        This function is OK. But if you are copying a text ~!@#$%^&*()_+-={}|[]\:";'<>?,./` to your textbox, this function will not be called.
I guess Regex expressions are the best way to use it on save.
                                        I guess Regex expressions are the best way to use it on save.
0
                                Hi Sharmin,
You can override the _onTextBoxPasteHandler handler such way:
 
All the best,
Vasil
the Telerik team
                                        You can override the _onTextBoxPasteHandler handler such way:
Telerik.Web.UI.RadInputControl.prototype.orgPasteHandler = Telerik.Web.UI.RadInputControl.prototype._onTextBoxPasteHandler ;Telerik.Web.UI.RadInputControl.prototype._onTextBoxPasteHandler = function(e){     //do your logic here; then execute the original handler if you need:    this.Telerik.Web.UI.RadInputControl.prototype.orgPasteHandler(e);}All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
                                
                                                    Jim
                                                    
                                            
    Top achievements
    
            
                 Rank 1
                Rank 1
            
    
                                                
                                                answered on 03 Jun 2013, 10:48 AM
                                            
                                        Hi,
Can someone post an example of how to override the _onTextBoxPasteHandler handler in VB?
Thanks,
Jim
                                        Can someone post an example of how to override the _onTextBoxPasteHandler handler in VB?
Thanks,
Jim
0
                                Hello Jim,
The code is JavaScript (not C# or VB). You just need to wrap it with <script> tag and place under the declaration of your ScriptManager in your ASPX page.
Regards,
Vasil
Telerik
                                        The code is JavaScript (not C# or VB). You just need to wrap it with <script> tag and place under the declaration of your ScriptManager in your ASPX page.
Regards,
Vasil
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.