I need to add my own attribute to a RadMaskedTextBox but can't seem to do it. Any ideas? Here's the aspx:
<telerik:RadMaskedTextBox
ID="txtSocial_Security_Number" runat="server" SelectionOnFocus="SelectAll" Mask="###-##-####"
requiredrule='<%#required("Social_Security_Number_Or_Federal_Identification_Number")%>'
onkeyup="ValidateTBNew()">
</telerik:RadMaskedTextBox>
The requiredrule pulls a rule from the back end, as you can see. But when Telerik renders the control, the requiredrule is gone! Here's the rendered HTML:
<span id="RadPanelBar1_i2_i0_txtSocial_Security_Number_wrapper"
class="riSingle RadInput RadInput_Default"
style="width:130px;">
<input id="RadPanelBar1_i2_i0_txtSocial_Security_Number"
name="RadPanelBar1$i2$i0$txtSocial_Security_Number"
type="text" size="20"
class="riTextBox riEnabled"
onkeyup="ValidateTBNew()"
value="111-11-1111" />
<input id="RadPanelBar1_i2_i0_txtSocial_Security_Number_ClientState"
name="RadPanelBar1_i2_i0_txtSocial_Security_Number_ClientState"
type="hidden" />
</span>
My onkeyup is there but no sign of the requiredrule. The reason for the requiredrule is so that it can be used to determine one of several states of failure - in the javascript function called in the onkeyup event.
Here's the way I was able to git-er-done... I was using the RadMaskedTextBox but Telerik says that they are deprecating it. Instead, I used an asp:TextBox and the RadInputManager. Here's the code if you need it.
<asp:TextBox ID="txtSSN" runat="server"
requiredrule='<%#required("Social_Security_Number_Or_Federal_Identification_Number")%>'
onkeyup="ValidateTBNew()"></asp:TextBox>
and
<telerik:RadInputManager ID="RadInputManager1" runat="server">
<telerik:MaskedTextBoxSetting Mask="###-##-####" SelectionOnFocus="SelectAll">
<TargetControls>
<telerik:TargetInput ControlID="txtSSN" />
</TargetControls>
</telerik:MaskedTextBoxSetting>
</telerik:RadInputManager>
This way, the TextBox correctly renders with my extra requiredrule attribute and the formatting of the SSN is done with the RadInputManager.