We are using "RadInput.Net2.dll" and RadMaskedTextBox for phone number. For validating phone number format as (###) ###-####, we are using RegularExpressionValidator.
Below is the code we used
<radI:RadMaskedTextBox ID="txtPhone" runat="server"></radI:RadMaskedTextBox><br />
<asp:RegularExpressionValidator ID="revOtherPhone" Display="dynamic" ControlToValidate="txtPhone" ValidationExpression ="^(\([0-9]\d{2}\)|[0-9]\d{2})[- .]?\d{3}[- .]?\d{4}$" ToolTip="Input other phone" ErrorMessage="Enter the correct phone number." runat="server"></asp:RegularExpressionValidator>
The functionality is working fine OnKeyPress event.
But we do not want to display the error message on every key press. We want to display the error message only on tab / mouse out from text box like demo available in "http://demos.telerik.com/aspnet-ajax/input/examples/common/validation/defaultcs.aspx"
But we have used the same code as mentioned in the demo source code. But we are getting the validation message at every key press event instead of tab out.
Iwe could not find out where the RegularExpressionValidator validation event is setup for RadMaskedTextBox key press. Could you please help me to fix this issue?
Thanks in advance.
We are using "RadInput.Net2.dll" and RadMaskedTextBox for phone number. We want to check if first character of area code should not be 0 or 1.
If we use CustomValidator and javascript as below, it is working fine.
For example, if phone # is "(316) 446-2777" and if I replace 3 as 1, I could see the correct error message. But if I delete 3, I can see numbers in text box as "(_16) 446-2777". But still I can see the error message as "This number cannot begin with a 1 or 0.". The prompt character is not part of the args.value.
I want to display the error message only if first character after ( is 0 or 1. Could you please help us to find out the first character only of the input text
Thanks in advance.
<
radI:RadMaskedTextBox
ID
=
"txtPhone"
runat
=
"server"
>
</
radI:RadMaskedTextBox
><
br
/>
<
asp:CustomValidator
id
=
"revBusinessPhone"
Display
=
"dynamic"
runat
=
"server"
ControlToValidate
=
"txtPhone"
ErrorMessage
=
"This number cannot begin with a 1 or 0."
ClientValidationFunction
=
"validateLength"
></
asp:CustomValidator
>
function validateLength(oSrc, args) {
var phnVal = args.Value;
if (((phnVal1.substring(0, 2)) == "(1" || (phnVal.substring(0, 2) == "(0"))) {
oSrc.innerText = "This number cannot begin with a 1 or 0.";
args.IsValid = false;
}
else {
var regex = /^(\([0-9]\d{2}\)|[0-9]\d{2})[- .]?\d{3}[- .]?\d{4}$/;
if (regex.test(phnVal)) {
args.IsValid = true;
}
else {
oSrc.innerText = "This number must contain 10 digits.";
args.IsValid = false;
}
}
return true;
}
treeView.get_nodes().clear();
if
(treeNodesResults !=
null
)
{
for
(
var
i = 0; i < treeNodesResults.length; i++)
{
var
node =
new
Telerik.Web.UI.RadTreeNode();
node.set_text(treeNodesResults[i].Text);
node.set_value(treeNodesResults[i].Value);
node.set_expandMode(treeNodesResults[i].ExpandMode);
node.set_imageUrl(treeNodesResults[i].ImageUrl);
var
checkable =
false
;
var
checkableAttribute = node.get_attributes().getAttribute(
"Checkable"
);
if
(checkableAttribute !=
null
)
{
checkable = checkableAttribute ==
"true"
;
}
node.set_checkable(checkable);
if
(checkable)
{
var
checked =
false
;
var
checkedAttribute = node.get_attributes().getAttribute(
"Checked"
) ==
"true"
;
if
(checkedAttribute !=
null
)
{
checked = checkedAttribute ==
"true"
;
}
node.set_checked(checked);
}
treeView.get_nodes().add(node);
}
}
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
|
if ($telerik.isIE || $telerik.isFirefox)
{
sizingElement = contentFrame;
}
<configuration> |
<configSections> |
<sectionGroup name="telerik.web.ui"> |
<section name="radScheduler" type="Telerik.Web.UI.RadSchedulerConfigurationSection, Telerik.Web.UI, PublicKeyToken=121fae78165ba3d4" allowDefinition="MachineToApplication"/> |
</sectionGroup> |
</configSections> |
<telerik.web.ui> |
<radScheduler defaultAppointmentProvider="Integrated"> |
<appointmentProviders> |
<add name="SchedulerData" type="Telerik.Web.Scheduler.MyDbSchedulerProvider" connectionStringName="LocalSqlServer" persistChanges="true" /> |
</appointmentProviders> |
</radScheduler> |
</telerik.web.ui> |
<appSettings/> |
<connectionStrings> |
<remove name="LocalSqlServer"/> |
<add name="LocalSqlServer" connectionString="Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|sc.mdf"/> |
</connectionStrings> |
<telerik:RadScheduler runat="server" ID="RadScheduler1" SelectedView="Month" DayStartTime="08:00:00" DayEndTime="18:00:00" ProviderName="SchedulerData" ReadOnly="false"> |