Archive for July, 2016

Allow User to Enter Arabic Characters Or Number Only

July 24, 2016 Leave a comment

Dear all,

Try this example to Validate User to enter Arabic characters or numbers only

<asp:TextBox ID="txt_Name" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="rev_Name" runat="server" ErrorMessage="*" ControlToValidate="txt_Name" ValidationExpression="^[0-9\u0600-\u06FF/ ]+$" ></asp:RegularExpressionValidator>

Hope this helps

Good Luck.

Categories: ASP.Net

Set Maximum characters to 1000 for Multiline TextBox Using JQuery

July 22, 2016 Leave a comment

Hi all,

Try this example to Set Maximum characters to 1000 for Multiline TextBox Using JQuery

<script src=""></script>
 <script type="text/javascript">
 $(document).ready(function () {
 //Assign the text to span in pageload
 $('#spntxtMult').text("Number of characters 0/1000");
 //attach change event to div
 $('#txtMult').keyup(function (event) {
 //call function to calcualate count on change event of div
 function textCounter() {
 //Get the max length countnt
 var divlength = $('#txtMult').val().length;
 //check if count greater than 1000
 if (divlength > 1000) {
 //Trim the text
 var trimmedtext = $('#txtMult').val().substring(0, 1000);
 //assign it to textbox
 else {
 var remaningchar = 0;
 //Calculate the remining char
 if (divlength > 0) {
 remaningchar = 1000 - divlength;

//reduce the allowed no of characters in span
 $('#spntxtMult').text("Number of characters " + remaningchar + "/1000");
<asp:TextBox ID="txtMult" runat="Server" TextMode="MultiLine" />
<span id="spntxtMult"></span>

Hope this helps

Good Luck.

Categories: ASP.Net, Javascript, Jquery