TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kalpana jaiswal
NA
45
9.6k
disable characters while entering contact number in textbox
Mar 13 2016 4:05 AM
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript" src="JavaScripts/jquery.js"></script>
<script type="text/javascript">
$(function () {
$(".xyz").keydown(function (e) {
if (e.shiftKey || e.ctrlKey || e.altKey) {
e.preventDefault();
}
else {
var key = e.keyCode;
}
if (!((key == 8) || (key == 46) || (key >= 35 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105))) {
e.preventDefault();
}
});
});
</script>
<asp:TextBox ID="txtCont" class="xyz" runat="server"></asp:TextBox></td>
<td colspan="1">
<asp:RequiredFieldValidator ID="rfvtxtCont" runat="server" ControlToValidate="txtCont" ForeColor="Red" ErrorMessage="Contact No is mandatory" ToolTip="Please enter the Contact No" Text=" * " SetFocusOnError="true" ValidationGroup="Register"></asp:RequiredFieldValidator></td>
<td>
<asp:RegularExpressionValidator ID="regContact" runat="server" ErrorMessage="Contact no shhould be 10 digit number" SetFocusOnError="True" Text="*" ToolTip="Contact no shhould be 10 digit number" ValidationGroup="Register" ValidationExpression="^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$" ControlToValidate="txtCont"></asp:RegularExpressionValidator>
Reply
Answers (
1
)
window Application to Web Application mvc 5
how to generate textbox automatically using jquery