ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2018 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>https://www.aspforums.net:443/Threads/116803/Validate-PAN-number-in-ASPNet-TextBox-using-Regular-Expression/https://www.aspforums.net:443/Threads/116803/Validate-PAN-number-in-ASPNet-TextBox-using-Regular-Expression/Tue, 11 Nov 2014 04:25:22 GMTValidate Mobile number using RegularExpressionValidator in ASP.Net<p>Please tell me validation coding for mobile number validation upto 10 digits. In case less or greater than 10 digit it must have to display as a invalid statement.</p> <p><strong>This is my registration coding page</strong></p> <pre class="brush: html">&lt;%@ Page Language=&#34;C#&#34; AutoEventWireup=&#34;true&#34; CodeFile=&#34;register.aspx.cs&#34; Inherits=&#34;register&#34; %&gt; &lt;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&gt; &lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34; &gt; &lt;head runat=&#34;server&#34;&gt; &nbsp;&nbsp;&nbsp; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body background=&#34;images/238534-online-exam-background-e1426473359694.jpg&#34;&gt; &nbsp;&nbsp;&nbsp; &lt;form id=&#34;form1&#34; runat=&#34;server&#34;&gt; &nbsp;&nbsp;&nbsp; &lt;div&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label1&#34; runat=&#34;server&#34; Font-Bold=&#34;True&#34; Font-Size=&#34;X-Large&#34; Style=&#34;z-index: 100; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left: 531px; position: absolute; top: 33px&#34; Text=&#34;REGISTRATION&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label2&#34; runat=&#34;server&#34; Font-Size=&#34;Large&#34; Style=&#34;z-index: 101; left: 441px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 129px&#34; Text=&#34;NAME:&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label3&#34; runat=&#34;server&#34; Font-Size=&#34;Large&#34; Style=&#34;z-index: 102; left: 438px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 170px&#34; Text=&#34;EMAIL ID:&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label4&#34; runat=&#34;server&#34; Font-Size=&#34;Large&#34; Style=&#34;z-index: 103; left: 438px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 208px&#34; Text=&#34;PASSWORD:&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label5&#34; runat=&#34;server&#34; Font-Size=&#34;Large&#34; Style=&#34;z-index: 104; left: 436px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 247px&#34; Text=&#34;CONFIRM PASSWORD:&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label6&#34; runat=&#34;server&#34; Font-Size=&#34;Large&#34; Style=&#34;z-index: 105; left: 436px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 287px&#34; Text=&#34;MOBILE NUMBER:&#34;&gt;&lt;/asp:Label&gt; // validation have to display &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label7&#34; runat=&#34;server&#34; Font-Size=&#34;Large&#34; Style=&#34;z-index: 106; left: 435px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 325px&#34; Text=&#34;COURSES:&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&#34;TextBox1&#34; runat=&#34;server&#34; Style=&#34;z-index: 107; left: 676px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 123px&#34;&gt;&lt;/asp:TextBox&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&#34;TextBox2&#34; runat=&#34;server&#34; Style=&#34;z-index: 108; left: 676px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 166px&#34;&gt;&lt;/asp:TextBox&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&#34;TextBox3&#34; runat=&#34;server&#34; Style=&#34;z-index: 109; left: 676px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 202px&#34; TextMode=&#34;Password&#34; Width=&#34;150px&#34;&gt;&lt;/asp:TextBox&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&#34;TextBox4&#34; runat=&#34;server&#34; Style=&#34;z-index: 110; left: 676px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 243px&#34; TextMode=&#34;Password&#34; Width=&#34;152px&#34;&gt;&lt;/asp:TextBox&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&#34;TextBox5&#34; runat=&#34;server&#34; Style=&#34;z-index: 111; left: 677px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 283px&#34;&gt;&lt;/asp:TextBox&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:DropDownList ID=&#34;DropDownList1&#34; runat=&#34;server&#34; Style=&#34;z-index: 112; left: 676px; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position: absolute; top: 320px&#34;&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ListItem&gt;IBPS-PO&lt;/asp:ListItem&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ListItem&gt;IBPS-Clerk&lt;/asp:ListItem&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ListItem&gt;TNPSC&lt;/asp:ListItem&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ListItem&gt;VAO&lt;/asp:ListItem&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/asp:DropDownList&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Button ID=&#34;Button1&#34; runat=&#34;server&#34; OnClick=&#34;Button1_Click&#34; Style=&#34;z-index: 113; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left: 469px; position: absolute; top: 392px&#34; Text=&#34;REGISTER&#34; /&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Button ID=&#34;Button2&#34; runat=&#34;server&#34; OnClick=&#34;Button2_Click&#34; Style=&#34;z-index: 114; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left: 679px; position: absolute; top: 388px&#34; Text=&#34;CLEAR&#34; /&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:Label ID=&#34;Label8&#34; runat=&#34;server&#34; Font-Bold=&#34;True&#34; Font-Size=&#34;Large&#34; ForeColor=&#34;Maroon&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Style=&#34;z-index: 115; left: 815px; position: absolute; top: 393px&#34;&gt;&lt;/asp:Label&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:ImageButton ID=&#34;ImageButton1&#34; runat=&#34;server&#34; Height=&#34;53px&#34; ImageUrl=&#34;~/images/111645-glowing-green-neon-icon-media-a-media31-back.png&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnClick=&#34;ImageButton1_Click&#34; PostBackUrl=&#34;~/Default.aspx&#34; Style=&#34;z-index: 116; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; left: 910px; position: absolute; top: 425px&#34; Width=&#34;59px&#34; /&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:RegularExpressionValidator ID=&#34;RegularExpressionValidator1&#34; runat=&#34;server&#34; ControlToValidate=&#34;TextBox2&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorMessage=&#34;Invalid Email-id&#34; Style=&#34;z-index: 118; left: 857px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 165px&#34; ValidationExpression=&#34;\w+([-+.&#39;]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*&#34;&gt;&lt;/asp:RegularExpressionValidator&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:CompareValidator ID=&#34;CompareValidator1&#34; runat=&#34;server&#34; ControlToCompare=&#34;TextBox3&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ControlToValidate=&#34;TextBox4&#34; ErrorMessage=&#34;Both Passwords are not same&#34; Height=&#34;21px&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Style=&#34;z-index: 119; left: 860px; position: absolute; top: 244px&#34; Width=&#34;186px&#34;&gt;&lt;/asp:CompareValidator&gt; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp;nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;asp:RequiredFieldValidator ID=&#34;RequiredFieldValidator3&#34; runat=&#34;server&#34; ControlToValidate=&#34;DropDownList1&#34; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ErrorMessage=&#34;fill the field&#34; Style=&#34;z-index: 122; left: 863px; position: absolute; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; top: 322px&#34;&gt;&lt;/asp:RequiredFieldValidator&gt; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &lt;/div&gt; &nbsp;&nbsp;&nbsp; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</pre> <p>C# coding:</p> <pre class="brush: csharp">using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class register : System.Web.UI.Page { &nbsp;&nbsp;&nbsp; protected void Page_Load(object sender, EventArgs e) &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; protected void ImageButton1_Click(object sender, ImageClickEventArgs e) &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Redirect(&#34;Default.aspx&#34;); &nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; protected void Button2_Click(object sender, EventArgs e) &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TextBox1.Text = String.Empty; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TextBox2.Text = String.Empty; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TextBox3.Text = String.Empty; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TextBox4.Text = String.Empty; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TextBox5.Text = String.Empty; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Label8.Text = String.Empty; &nbsp;&nbsp;&nbsp; } &nbsp;&nbsp;&nbsp; protected void Button1_Click(object sender, EventArgs e) &nbsp;&nbsp;&nbsp; { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlConnection con = new SqlConnection(@&#34;Data Source=ADMIN-PC\SQLEXPRESS;Initial Catalog=exam;Integrated Security=True&#34;); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Open(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String str=&#34;insert into reg(sname,semail,spass,sconfirm,smobile,scourse)values(&#39;&#34; + TextBox1.Text + &#34;&#39;,&#39;&#34; + TextBox2.Text + &#34;&#39;,&#39;&#34; + TextBox3.Text + &#34;&#39;,&#39;&#34; + TextBox4.Text + &#34;&#39;,&#39;&#34; + TextBox5.Text + &#34;&#39;,&#39;&#34;+DropDownList1.Text+&#34;&#39;)&#34;; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlCommand cmd = new SqlCommand(str, con); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.ExecuteNonQuery(); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.AddWithValue(&#34;sname&#34;, TextBox1.Text); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.AddWithValue(&#34;semail&#34;, TextBox2.Text); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.AddWithValue(&#34;spass&#34;, TextBox3.Text); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.AddWithValue(&#34;sconfirm&#34;, TextBox4.Text); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.AddWithValue(&#34;smobile&#34;, TextBox5.Text); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.AddWithValue(&#34;scourse&#34;, DropDownList1.Text); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Label8.Visible = true; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Label8.Text = &#34;Registered Successfully&#34;; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String Display = &#34;Registered Successfully&#34;; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ClientScript.RegisterStartupScript(this.GetType(), &#34;myalert&#34;, &#34;alert(&#39;&#34; + Display + &#34;&#39;);&#34;, true); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.Close(); &nbsp;&nbsp;&nbsp; } }</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/863665/Validate-Mobile-number-using-RegularExpressionValidator-in-ASPNet/https://www.aspforums.net:443/Threads/863665/Validate-Mobile-number-using-RegularExpressionValidator-in-ASPNet/Sat, 10 Feb 2018 03:44:57 GMTValidate IpAddress using Regular Expressions (Regex) in ASP.Net<p>Hi,</p> <p>How to write validation for IpAddress in asp.net.</p>https://www.aspforums.net:443/Threads/184457/Validate-IpAddress-using-Regular-Expressions-Regex-in-ASPNet/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/101081/Validate-Http-and-Https-Url-using-RegularExpression-Regex-in-JavaScript/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/885274/Toggle-Multiple-RegularExpression-Validators-for-one-TextBox-based-on-RadioButton-selection-in-ASPNet/https://www.aspforums.net:443/Threads/885274/Toggle-Multiple-RegularExpression-Validators-for-one-TextBox-based-on-RadioButton-selection-in-ASPNet/Wed, 24 Sep 2014 02:27:18 GMTSet ASP.Net RegularExpression Validator Expression based on DropDownList using C# and VB.Net<p>I have a regular expression&nbsp; like below what my goal when user changed dropdown country in that&nbsp; ddl country selected index depending on the country i have set</p> <p>But my problem is when there is no VatRegularExpression value. for example when i select country germany&nbsp;there is no regular expression for this country.then also still it is giving the error message but it should not give the error message.Can you help me out please</p> <pre class="brush: vb">VatRegularExpression = sp.CountryVatRegularExpressionGet(ddlCountry.SelectedValue)&nbsp; ---here i&nbsp; am getting regular expression from database If Not String.IsNullOrEmpty(VatRegularExpression) Then RegtxtVatCode.Enabled = True RegtxtVatCode.ValidationExpression = VatRegularExpression End If</pre> <p>&nbsp;</p> <pre class="brush: html">&lt;asp:RegularExpressionValidator ID=&#34;RegtxtVatCode&#34; Enabled=&#34;false&#34; runat=&#34;server&#34; ControlToValidate=&#34;txtVatCode&#34; Display=&#34;Dynamic&#34; CssClass=&#34;help-block&#34; ErrorMessage=&#34;&lt;%$ Resources: res, WrongVatCode %&gt;&#34;&gt; &lt;/asp:RegularExpressionValidator&gt;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/193275/Set-ASPNet-RegularExpression-Validator-Expression-based-on-DropDownList-using-C-and-VBNet/https://www.aspforums.net:443/Threads/193275/Set-ASPNet-RegularExpression-Validator-Expression-based-on-DropDownList-using-C-and-VBNet/Sun, 18 Nov 2018 22:46:52 GMTRetrieve only image tag from TinyMCE editor in ASP.Net using RegularExpression in C# and VB.Net<p>Dear Sir/Madam,</p> <p>i am using the tinymce editor and i am saving the content in db.</p> <p>its working fine.</p> <p>but the problem is that how can i hide all the html tags(of the content data) leaving the image tag on page load.</p> <p>is that possible to remove all html tags leaving one html tag.</p> <p>thanks for your help in advance.</p> <p>&nbsp;</p> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/144897/Retrieve-only-image-tag-from-TinyMCE-editor-in-ASPNet-using-RegularExpression-in-C-and-VBNet/https://www.aspforums.net:443/Threads/144897/Retrieve-only-image-tag-from-TinyMCE-editor-in-ASPNet-using-RegularExpression-in-C-and-VBNet/Mon, 26 Feb 2018 05:38:41 GMTRetrieve Number from String using Regular Expression in C# and VB.Net<p>Hi! How I can get only number from text.</p> <p>&nbsp;</p> <pre class="brush: csharp">string selected = &#34;&#34;; int selectedBolsCount = 1; string selectedValues = &#34;Let me introduce myself&infin;1My full name is Andrei Andreevich Ivanov&infin;2I was named after my father and I am very happy about it&infin;3I was born on April, 7, 1981 in Moscow&infin;4I come from the family of office workers&infin;5I am an only child in the family&infin;6I am a pupil of the eleventh form of a secondary school&infin;7 I&#39;m finishing school this year&infin;8I want to enter the University of Moscow&infin;9That is why I have to study twice as hard as an ordinary pupil&infin;10I&#39;m not only doing my best at school, I&#39;m taking a preparatory course at the University&infin;11&#34;; foreach (string item in selectedValues.Split(&#39;&infin;&#39;)) { selected = string.Join(&#34;,&#34;, selectedValues); selectedBolsCount++; } </pre> <p>Output result:</p> <p>1,2,3,4,5,6,7,8,9,10,11</p>https://www.aspforums.net:443/Threads/126839/Retrieve-Number-from-String-using-Regular-Expression-in-C-and-VBNet/https://www.aspforums.net:443/Threads/126839/Retrieve-Number-from-String-using-Regular-Expression-in-C-and-VBNet/Fri, 05 Oct 2018 04:13:19 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>https://www.aspforums.net:443/Threads/769634/RegularExpression-to-check-whether-ZipCode-PinCode-exists-or-not/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/543494/RegularExpression-to-accepts-only-integer-and-float-in-ASPNet/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/294492/Regular-expression-to-have-combination-of-UpperCase-and-LowerCase-Alphabets/https://www.aspforums.net:443/Threads/294492/Regular-expression-to-have-combination-of-UpperCase-and-LowerCase-Alphabets/Mon, 18 Nov 2013 03:03:10 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>https://www.aspforums.net:443/Threads/146452/Regular-Expression-that-matches-anything-after-space-in-C-Net/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/148236/Regular-expression-for-validate-Mobile-number-using-RegularExpressionValidator-in-ASPNet/https://www.aspforums.net:443/Threads/148236/Regular-expression-for-validate-Mobile-number-using-RegularExpressionValidator-in-ASPNet/Fri, 14 Jul 2017 05:24:24 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>https://www.aspforums.net:443/Threads/185009/Remove-tab-and-new-line-space-using-RegularExpression-in-ASPNet/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/171714/Remove-and-replace-Plus-character-with-space-using-RegularExpression-Regex-and-JavaScript/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/183398/RegularExpression-Validator-Regex-to-check-whether-string-has-Dot-and-Hyphen-ASPNet/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/128643/RegularExpression-Validator-Regex-to-check-valid-HTTP-HTTPS-and-FTP-URLs-in-ASPNet/https://www.aspforums.net:443/Threads/128643/RegularExpression-Validator-Regex-to-check-valid-HTTP-HTTPS-and-FTP-URLs-in-ASPNet/Tue, 18 Aug 2015 08:40:14 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>https://www.aspforums.net:443/Threads/140291/Regular-Expression-for-Alphabets-in-sequence-followed-by-Digits-Numbers/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/218172/Regular-Expression---Minimum-5-characters-with-atleast-one-numeric-character/https://www.aspforums.net:443/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>https://www.aspforums.net:443/Threads/193093/Regular-Expression-Regex-for-toll-free-number-1-800--/https://www.aspforums.net:443/Threads/193093/Regular-Expression-Regex-for-toll-free-number-1-800--/Mon, 04 Jan 2016 01:05:59 GMT