Hi,
Im trying to change the Filter Type of FilteredTextBoxExtender on a checkbox onClick handler.
(The textBox which is my traget control is also a the target control of an AutoCompleteExtender control).
The user can switch between searching an item by its Number ID or by Its name)
therefore I need to change the type dynamically according to the checked property of a check box.
it works fine until I try to change the valid characters. I get the following exception on client side:
Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'String' cannot be converted to type 'AjaxControlToolkit.FilterTypes'.
Parameter name: value
HTML:
<ajaxToolkit:FilteredTextBoxExtenderID="FilteredTextBoxExtender1"runat="server"BehaviorID="FilteredTextBoxTxtStock"TargetControlID="txtStkNum"FilterType="Numbers, Custom">
</ajaxToolkit:FilteredTextBoxExtender>
1function chkNameList_click()2 {34 var autoComplete = $find('AutoCompleteBehavior');5 var TextBoxFilter = $find('FilteredTextBoxTxtStock');67 $get('<%=txtStkNum.ClientID%>').value ="";89if($get('UserContext').checked ==true)//Names10 {11 $get('<%=txtStkNum.ClientID%>').className ="txtStockHeb";//right alignment (text box)12 TextBoxFilter.set_ValidChars("?????????????????????? ");1314 }15else//Numbers16 {17 $get('<%=txtStkNum.ClientID%>').className ="txtStockEng";//left alignment (text box)18 TextBoxFilter.set_FilterType("Numbers");19 }20 }
Thanks,
Tal
Hi Tal88,
Based on my research , I think your problem is mainly caused by TextBoxFilter.set_FilterType("Numbers");
Below is the FilterTypes,
AjaxControlToolkit.FilterTypes.prototype = {
Custom : 0x1, //1
Numbers : 0x2, //2
UppercaseLetters : 0x4, //3
LowercaseLetters : 0x8 //4
}
So if you want to set the FilterTypes to Custom, you should use TextBoxFilter.set_FilterType(1);
Numbers will be TextBoxFilter.set_FilterType(2);
If the FilterTypes is set to "Custom,Numbers,LowercaseLetters", please use TextBoxFilter.set_FilterType(7); //1+2+4
My Ajax Control Toolkit's version is V10618.
I hope this help.
Best regards,
Jonathan
No comments:
Post a Comment