Hello,
I do have a litte Problem setting the Mask of a RadMaskedTextBox via Javascript. Actually the mask gets set correct and I'd say my code works. However, the mask only gets displayed if I start typing in the Textbox. If I set the value to something that satisfied the mask, the value isn't displayed either.
I've already found the previous Thread on this topic, but neither setting the value nor setting the length worked for me.
Here's the code I use:
Thanks in advance
I do have a litte Problem setting the Mask of a RadMaskedTextBox via Javascript. Actually the mask gets set correct and I'd say my code works. However, the mask only gets displayed if I start typing in the Textbox. If I set the value to something that satisfied the mask, the value isn't displayed either.
I've already found the previous Thread on this topic, but neither setting the value nor setting the length worked for me.
Here's the code I use:
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function valueChanged(sender, eventArgs) {
var db1TextBox = $find("<%= txtFoo.ClientID %>");
var db1value = db1TextBox.get_value();
var db2TextBox = $find("<%= txtBar.ClientID %>");
var masks = [
new Telerik.Web.UI.RadLiteralMaskPart(db1value[0]),
new Telerik.Web.UI.RadLiteralMaskPart(db1value[1]),
new Telerik.Web.UI.RadLiteralMaskPart(db1value[2]),
new Telerik.Web.UI.RadLiteralMaskPart(db1value[3]),
new Telerik.Web.UI.RadLiteralMaskPart(db1value[4]),
new Telerik.Web.UI.RadLiteralMaskPart(db1value[5]),
new Telerik.Web.UI.RadNumericRangeMaskPart(0, 9, false, true),
new Telerik.Web.UI.RadNumericRangeMaskPart(0, 9, false, true)
];
db2TextBox._length = 0;
db2TextBox._setMask(masks);
db2Textbox._setValue('');
}
</
script
>
</
telerik:RadScriptBlock
>
<
div
>
<
telerik:RadMaskedTextBox
ID
=
"txtFoo"
Mask="<0..9><
0..9
><
0..9
><
0..9
><
0..9
><
0..9
>" runat="server" ClientEvents-OnValueChanged="valueChanged"/>
<
telerik:RadMaskedTextBox
ID
=
"txtBar"
runat
=
"server"
></
telerik:RadMaskedTextBox
>
</
div
>
Thanks in advance