0
Posted on 5:43 AM by prajeesh and filed under
ASP.net
In some situations we may need to maintain the scroll bar position when we are dealing with large pages with a button causes post back, you can use achieve this by adding MaintainScrollPositionOnPostback=”true” in @Page directive.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" MaintainScrollPositionOnPostback ="true" %>
0
E-mail
^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
URL
^(htf)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$
Social Security Number
^\d{3}-\d{2}-\d{4}$
Phone number(Validates US Phone number)
^[01]?[- .]?(\([2-9]\d{2}\)[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$
Zip Code(Validates US Zip code)
^(\d{5}-\d{4}\d{5}\d{9})$^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$
Currency(Non Negative)
^\d+(\.\d\d)?$
Currency(+ve or -ve)
^(-)?\d+(\.\d\d)?$
Non Negative Integer
^\d+$
For a detailed article on reguler expressions, refer : http://msdn.microsoft.com/en-us/library/ms972966.aspx
Posted on 10:29 PM by prajeesh and filed under
ASP.net,
Regule expressions
Here is the list of some commonly used reguler expressions for validating your forms. ^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$
URL
^(htf)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&%\$#_]*)?$
Social Security Number
^\d{3}-\d{2}-\d{4}$
Phone number(Validates US Phone number)
^[01]?[- .]?(\([2-9]\d{2}\)[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$
Zip Code(Validates US Zip code)
^(\d{5}-\d{4}\d{5}\d{9})$^([a-zA-Z]\d[a-zA-Z] \d[a-zA-Z]\d)$
Currency(Non Negative)
^\d+(\.\d\d)?$
Currency(+ve or -ve)
^(-)?\d+(\.\d\d)?$
Non Negative Integer
^\d+$
For a detailed article on reguler expressions, refer : http://msdn.microsoft.com/en-us/library/ms972966.aspx