ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2017 www.aspforums.com. All rights reserved.Validate PAN number in ASP.Net TextBox using Regular Expression<p>I have a textBox that will accept Pan number.</p> <p>Please tell how to validate the text box,so that it will take only pan number..</p>http://www.aspforums.net/Threads/116803/Validate-PAN-number-in-ASPNet-TextBox-using-Regular-Expression/http://www.aspforums.net/Threads/116803/Validate-PAN-number-in-ASPNet-TextBox-using-Regular-Expression/Tue, 11 Nov 2014 04:25:22 GMTValidate IpAddress using Regular Expressions (Regex) in ASP.Net<p>Hi,</p> <p>How to write validation for IpAddress in asp.net.</p>http://www.aspforums.net/Threads/184457/Validate-IpAddress-using-Regular-Expressions-Regex-in-ASPNet/http://www.aspforums.net/Threads/184457/Validate-IpAddress-using-Regular-Expressions-Regex-in-ASPNet/Tue, 09 Sep 2014 07:37:50 GMTValidate Http and Https Url using RegularExpression (Regex) in JavaScript<p>I need to implement URL Validation using Javascript in MVC4. Here is my code .</p> <pre class="brush: csharp">var regexp = &#34;^http(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\&#39;\/\\\+&amp;amp;%\$#_]*)?$&#34;; return regexp.test(URLValue);</pre> <p>but its not working in MVC 4. i thought test operation is not supported for MVC. Is there any solution to implement validation using Javascript.</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/101081/Validate-Http-and-Https-Url-using-RegularExpression-Regex-in-JavaScript/http://www.aspforums.net/Threads/101081/Validate-Http-and-Https-Url-using-RegularExpression-Regex-in-JavaScript/Sun, 16 Mar 2014 23:18:33 GMTToggle Multiple RegularExpression Validators for one TextBox based on RadioButton selection in ASP.Net<div class="post-text"> <p>I have a RadioButtonList that includes three values: - UPC - Description - ItemCode</p> <p>UPC can only allow numbers (0-9). Description can allow any text. ItemCode only allows numbers or letters.</p> <p>I have a textbox (txtbox_reportBy).</p> <p>Is there a way to setup three types of validators all for the same textbox based on which radiobutton value is selected?</p> <p>i.e. If UPC is selected, then the textbox's validator should only allow numbers. If Description is selected, then the textbox's validator probably don't have to validate anything. If ItemCode is selected, then the textbox's validator should only allow numbers or letters.</p> <p>Thanks.</p> </div>http://www.aspforums.net/Threads/885274/Toggle-Multiple-RegularExpression-Validators-for-one-TextBox-based-on-RadioButton-selection-in-ASPNet/http://www.aspforums.net/Threads/885274/Toggle-Multiple-RegularExpression-Validators-for-one-TextBox-based-on-RadioButton-selection-in-ASPNet/Wed, 24 Sep 2014 02:27:18 GMTRegularExpression to check whether ZipCode (PinCode) exists or not<p>Sir,</p> <p>Is there any regular expression validator to find that entered pincode really exists or not (<strong>without checking format of pincode</strong>).</p> <p><strong>OR</strong></p> <p>Any any other way to do this?.............</p> <p>&nbsp;</p>http://www.aspforums.net/Threads/769634/RegularExpression-to-check-whether-ZipCode-PinCode-exists-or-not/http://www.aspforums.net/Threads/769634/RegularExpression-to-check-whether-ZipCode-PinCode-exists-or-not/Wed, 15 Oct 2014 06:07:17 GMTRegularExpression to accepts only integer and float in ASP.Net <p>Hi,</p> <p>Im having textbox.i want that textbox can accept only integer,floats&nbsp;</p> <p>and other textbox can accept only numbers and comma.</p> <p>I also have RequiredFieldValidator as well as RegularExpressionvalidator on single control.</p> <p>But i meant to say single digit as atlease one no.</p> <p>i.e.when i enter only . in textbox it gets accepted.</p> <p>atlease one number and then dot must be there.</p> <p>Thanks.</p>http://www.aspforums.net/Threads/543494/RegularExpression-to-accepts-only-integer-and-float-in-ASPNet/http://www.aspforums.net/Threads/543494/RegularExpression-to-accepts-only-integer-and-float-in-ASPNet/Thu, 30 Jun 2016 03:52:18 GMTRegular expression to have combination of UpperCase and LowerCase Alphabets<p>Hi,</p> <p>I have to apply a validation to accept only combination of Upper and Lower case to textbox but not either complete lower or complete upper or anything else.&nbsp;</p> <p>I am using below code but it allows complete upper and complete lower.<span style="font-size: 9pt;">&nbsp;</span></p> <p>Please help to get this resolved.<span style="font-size: 9pt;">&nbsp;</span></p> <p>Thanks,</p> <p>Vidya</p> <pre class="brush: xml">&lt;asp:Content ID=&#34;BodyContent&#34; runat=&#34;server&#34; ContentPlaceHolderID=&#34;MainContent&#34;&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;First Name:&lt;/td&gt; &lt;td&gt;&lt;asp:TextBox ID=&#34;txtFirstname&#34; runat=&#34;server&#34;&gt;&lt;/asp:TextBox&gt;&lt;/td&gt; &lt;td&gt;&lt;asp:RegularExpressionValidator ID=&#34;revFirstName&#34; runat=&#34;server&#34; ControlToValidate=&#34;txtFirstname&#34; ValidationExpression=&#34;^[a-zA-Z]+$&#34; ErrorMessage=&#34;Only combination of Upper and lower allowed&#34; Display=&#34;Dynamic&#34;&gt; &lt;/asp:RegularExpressionValidator&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;asp:Button ID=&#34;cmdSubmit&#34; runat=&#34;server&#34; Text=&#34;Submit&#34; /&gt; &lt;/asp:Content&gt;</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/294492/Regular-expression-to-have-combination-of-UpperCase-and-LowerCase-Alphabets/http://www.aspforums.net/Threads/294492/Regular-expression-to-have-combination-of-UpperCase-and-LowerCase-Alphabets/Mon, 18 Nov 2013 03:03:10 GMTRemove tab and new line space using RegularExpression in ASP.Net<p>Dear All,</p> <p>I am trying to implement Google Map using Repeater and SQL Database based on the article: <a href="https://www.aspsnippets.com/Articles/ASPNet-Google-Maps-V3-with-Multiple-Markers-Database-Example.aspx">https://www.aspsnippets.com/Articles/ASPNet-Google-Maps-V3-with-Multiple-Markers-Database-Example.aspx</a></p> <p>The Google Map is not displaying on web, unless I <strong>"cut and paste" the Description text directly from SQL database.</strong></p> <p>Here is the code:</p> <pre class="brush: js">&lt;div id=&#34;dvMap&#34; style=&#34;border: thin solid #87ceeb; width:100%; height:300px;&#34;&gt;&lt;/div&gt; &lt;script type=&#34;text/javascript&#34;&gt; var markers = [ &lt;asp:Repeater ID=&#34;rptMarkers&#34; runat=&#34;server&#34;&gt; &lt;ItemTemplate&gt; { &#34;lat&#34;: &#39;&lt;%# Eval(&#34;PersonBruddLATITUDE&#34;) %&gt;&#39;, &#34;lng&#34;: &#39;&lt;%# Eval(&#34;PersonBruddLONGITUDE&#34;) %&gt;&#39;, &#34;title&#34;: &#39;&lt;%# Eval(&#34;PersonShipName&#34;) %&gt;&#39;, &#34;description&#34;: &#39;&lt;%# Eval(&#34;PersonBruddDescription&#34;) %&gt;&#39; } &lt;/ItemTemplate&gt; &lt;SeparatorTemplate&gt; , &lt;/SeparatorTemplate&gt; &lt;/asp:Repeater&gt; ]; &lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; window.onload = function () { var mapOptions = { center: new google.maps.LatLng(markers[0].lat, markers[0].lng), zoom: 10, gestureHandling: &#39;greedy&#39;, mapTypeId: google.maps.MapTypeId.ROADMAP }; var icon = &#34;http://www.kystregister.no/assets/img/locationSea.png&#34;; var infoWindow = new google.maps.InfoWindow(); var map = new google.maps.Map(document.getElementById(&#34;dvMap&#34;), mapOptions); for (i = 0; i &lt; markers.length; i++) { var data = markers[i]; var myLatlng = new google.maps.LatLng(data.lat, data.lng); var marker = new google.maps.Marker({ position: myLatlng, draggable: false, map: map, animation: google.maps.Animation.DROP, icon: new google.maps.MarkerImage(icon) }); (function (marker, data) { google.maps.event.addListener(marker, &#34;click&#34;, function () { infoWindow.setContent(&#34;&lt;div style = &#39;color:#12969b; font-weight:bold;&#39;&gt;&#34; + data.title + &#34;&lt;/div&gt;&#34; + &#34;&lt;br&gt;&#34; + &#34;&lt;div style = &#39;color:#2d2625;&#39;&gt;&#34; + data.description + &#34;&lt;/div&gt;&#34; + &#34;&lt;br&gt;&#34;); infoWindow.open(map, marker); }); })(marker, data); } } &lt;/script&gt;</pre> <p>Code behind:</p> <pre class="brush: csharp"> if (!this.IsPostBack) { DataTable dt = GetData(&#34;select * from brudd_Los where catID =&#39;&#34; + dataID.Text.Trim() + &#34;&#39;&#34;); rptMarkers.DataSource = dt; rptMarkers.DataBind(); }</pre> <pre class="brush: html">&lt;asp:TextBox ID=&#34;dataID&#34; runat=&#34;server&#34; &gt; &lt;/asp:TextBox&gt; &lt;asp:Button ID=&#34;Ebutton&#34; runat=&#34;server&#34; onclick=&#34;Button1_Click&#34; /&gt;</pre> <p>How to solve this issue?</p> <p>Many thanks</p>http://www.aspforums.net/Threads/185009/Remove-tab-and-new-line-space-using-RegularExpression-in-ASPNet/http://www.aspforums.net/Threads/185009/Remove-tab-and-new-line-space-using-RegularExpression-in-ASPNet/Tue, 26 Sep 2017 23:33:12 GMTRemove and replace Plus (+) character with space using RegularExpression (Regex) and JavaScript<p>&nbsp;</p> <pre class="brush: js">&lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function () { $.ajax({ type: &#34;POST&#34;, contentType: &#34;application/json; charset=utf-8&#34;, url: &#34;/Default.aspx/Spotlight&#34;, data: &#39;{}&#39;, dataType: &#34;json&#34;, success: function (data) { var myobject = JSON.stringify(data.d); $($.parseJSON(myobject)).each(function (index, el) { $(&#39;.titleofpost&#39;).text(el.post_title).replace(&#39;/+/g&#39;, &#39; &#39;); $(&#39;.titleofpost&#39;).attr(&#39;href&#39;, el.post_title); $(&#39;.appendspotlight&#39;).text(el.post_description); // document.write(el.post_title,el.post_date, el.post_credit, el.post_description, el.post_views); }); }, error: OnError }); }); } &lt;/script&gt;</pre> <p>&nbsp;</p> <pre class="brush: csharp">[ScriptMethod(ResponseFormat = ResponseFormat.Json)] [WebMethod] public static List&lt;Posts&gt; Spotlight() { string query = &#34;select TOP 1 post_date,post_tags,post_title,post_credit,post_id,post_description,post_views,post_image,post_know from posts where post_highlited=1&#34;; SqlCommand cmd = new SqlCommand(query); DataSet ds = GetData(cmd); DataTable dt = ds.Tables[0]; foreach (DataRow item in ds.Tables[0].Rows) { Posts post = new Posts(); post.post_title = HttpUtility.UrlEncode(item[&#34;post_title&#34;].ToString()); post.post_credit = item[&#34;post_credit&#34;].ToString(); post.post_date = String.Format(&#34;{0:ddd, MMM d, yyyy}&#34;, item[&#34;post_date&#34;]); post.post_description = item[&#34;post_description&#34;].ToString(); post.post_know = item[&#34;post_know&#34;].ToString(); post.post_views = Convert.ToInt16(item[&#34;post_views&#34;]); productt.Add(post); } return productt; }</pre> <p>I am getting json value for post_title in this format</p> <p>since i am using httputility.urlencode</p> <h2><a class="titleofpost" href="http://localhost:13607/Default.aspx#">Why+every+One+Should+Blog</a></h2> <p>I want to remove + and make it look like&nbsp;</p> <h2><a class="titleofpost" href="http://localhost:13607/Default.aspx#">Why every One Should Blog</a></h2> <p>&nbsp;</p>http://www.aspforums.net/Threads/171714/Remove-and-replace-Plus-character-with-space-using-RegularExpression-Regex-and-JavaScript/http://www.aspforums.net/Threads/171714/Remove-and-replace-Plus-character-with-space-using-RegularExpression-Regex-and-JavaScript/Mon, 21 Sep 2015 03:28:30 GMTRegularExpression Validator (Regex) to check whether string has Dot and Hyphen ASP.Net<p>I have a textbox,I want to validate it to contain alphabets and hypen and dot for Inserting name..</p> <p>ex for:Dr. HAMID-ULLAL</p> <p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</p> <pre class="brush: html">@Html.TextBoxFor(m =&gt; m.FirstName, new { @class = &#34;form-control validate[required,custom[onlyLetterSQ]]&#34;, @id = &#34;firstName&#34; })</pre> <p>&nbsp;</p>http://www.aspforums.net/Threads/183398/RegularExpression-Validator-Regex-to-check-whether-string-has-Dot-and-Hyphen-ASPNet/http://www.aspforums.net/Threads/183398/RegularExpression-Validator-Regex-to-check-whether-string-has-Dot-and-Hyphen-ASPNet/Mon, 20 Jul 2015 02:22:10 GMTRegularExpression Validator (Regex) to check valid HTTP, HTTPS and FTP URLs in ASP.Net<p>Hi ! this is my regular expression which i am using for url :</p> <pre class="brush: csharp">^((http|https|ftp)://)?(([\w-]+\.)+[^#?\s]+)(.*)?(#[\w\-]+)?$</pre> <p>Now it is allowing comma , i dont want to allow comma in it . Kindly help</p>http://www.aspforums.net/Threads/128643/RegularExpression-Validator-Regex-to-check-valid-HTTP-HTTPS-and-FTP-URLs-in-ASPNet/http://www.aspforums.net/Threads/128643/RegularExpression-Validator-Regex-to-check-valid-HTTP-HTTPS-and-FTP-URLs-in-ASPNet/Tue, 18 Aug 2015 08:40:14 GMTRegular Expression that matches anything after space in C# .Net<p>i have a string like</p> <p>str="arun vijay"</p> <p>&nbsp;</p> <p>i want only vijay..can anyone tel the regex for this&nbsp;</p>http://www.aspforums.net/Threads/146452/Regular-Expression-that-matches-anything-after-space-in-C-Net/http://www.aspforums.net/Threads/146452/Regular-Expression-that-matches-anything-after-space-in-C-Net/Tue, 18 Jun 2013 04:38:45 GMTRegular expression for validate Mobile number using RegularExpressionValidator in ASP.Net<p>can anybody help me regarding regular expreesion for mobile number .that should allow only numbers and should contain 10digits.</p> <p>&nbsp;</p> <p>googled &nbsp;somany contect but not find exactly.</p> <p>&nbsp;</p> <p>some are giving error when i entered bellow 10 digits.but if i enter 12 digits error is not giving.</p>http://www.aspforums.net/Threads/148236/Regular-expression-for-validate-Mobile-number-using-RegularExpressionValidator-in-ASPNet/http://www.aspforums.net/Threads/148236/Regular-expression-for-validate-Mobile-number-using-RegularExpressionValidator-in-ASPNet/Fri, 14 Jul 2017 05:24:24 GMTRegular Expression for Alphabets in sequence followed by Digits (Numbers)<p>i wanted the validation expression for id field. this field is such that it should contain the initial 3 upperspace characters and the next 7 as digits.</p> <p>ex- DFG5667878,DSF2465789.</p>http://www.aspforums.net/Threads/140291/Regular-Expression-for-Alphabets-in-sequence-followed-by-Digits-Numbers/http://www.aspforums.net/Threads/140291/Regular-Expression-for-Alphabets-in-sequence-followed-by-Digits-Numbers/Wed, 15 Apr 2015 07:45:52 GMTRegular Expression - Minimum 5 characters with atleast one numeric character<p>how to limit the user to enter atleast 5 letters and &nbsp;atleast 1 number in text field.</p>http://www.aspforums.net/Threads/218172/Regular-Expression---Minimum-5-characters-with-atleast-one-numeric-character/http://www.aspforums.net/Threads/218172/Regular-Expression---Minimum-5-characters-with-atleast-one-numeric-character/Wed, 29 Aug 2012 03:13:31 GMTRegular Expression (Regex) for toll free number 1 800 ###-####<p>What is the regular expression for USA toll free number&nbsp;<code>1 800 ###-####</code>? How to validate this for phone using c#? i want the regular expression only</p>http://www.aspforums.net/Threads/193093/Regular-Expression-Regex-for-toll-free-number-1-800--/http://www.aspforums.net/Threads/193093/Regular-Expression-Regex-for-toll-free-number-1-800--/Mon, 04 Jan 2016 01:05:59 GMTRegular Expression (Regex) for Phone number with Country code and 10 digits<p>I need regular expression for</p> <p>1)<strong>Phone</strong></p> <p>like&nbsp;</p> <p>+919000000000 (country code)(10 digits)</p> <p>&nbsp;</p> <div class="GrayBar">&nbsp;</div> <p>&nbsp;</p>http://www.aspforums.net/Threads/163613/Regular-Expression-Regex-for-Phone-number-with-Country-code-and-10-digits/http://www.aspforums.net/Threads/163613/Regular-Expression-Regex-for-Phone-number-with-Country-code-and-10-digits/Tue, 18 Nov 2014 02:22:39 GMTRegular Expression (Regex) for number with two decimal points in ASP.Net RegularExpression Validator <p>Restricting input to textbox: allowing only numbers and after input number allow one dot and after dot allow two number.&nbsp;</p>http://www.aspforums.net/Threads/494278/Regular-Expression-Regex-for-number-with-two-decimal-points-in-ASPNet-RegularExpression-Validator/http://www.aspforums.net/Threads/494278/Regular-Expression-Regex-for-number-with-two-decimal-points-in-ASPNet-RegularExpression-Validator/Sat, 28 Jun 2014 00:22:19 GMTRegular Expression (Regex) for Alphabets with special characters only<p>&nbsp;</p> <p>hwwllo can any one explain me how to set regular expression for textbox that allows a to z,A to Z, special characters(, &nbsp; &nbsp;. &nbsp;#) ie comma dot and hash</p>http://www.aspforums.net/Threads/376655/Regular-Expression-Regex-for-Alphabets-with-special-characters-only/http://www.aspforums.net/Threads/376655/Regular-Expression-Regex-for-Alphabets-with-special-characters-only/Mon, 10 Nov 2014 03:31:36 GMTRegex: Minimum 8 Characters at least 1 UpperCase 1 LowerCase 1 number and 1 Special Character<p>i need code to check the password policy using javascript for my change password page&nbsp;</p> <p>and the password policy should :</p> <p>length of password :10-12<br />min 1 uppaercase <br />min 1 lowercase<br />min 1 special char<br />and min 1 integer<br /><br />please reply soon.....&nbsp;</p>http://www.aspforums.net/Threads/186101/Regex-Minimum-8-Characters-at-least-1-UpperCase-1-LowerCase-1-number-and-1-Special-Character/http://www.aspforums.net/Threads/186101/Regex-Minimum-8-Characters-at-least-1-UpperCase-1-LowerCase-1-number-and-1-Special-Character/Tue, 04 Jun 2013 05:08:09 GMT