Powered By Blogger

Monday, November 23, 2009

validation in ASP.Net











































TITLE

EXPRESSION

DESCRIPTION

MATCHES

NUMBERS

^[0-9]*$

only numbers are allowed

12345 | 12345678

CURRENCY

^\d+(?:\.\d{0,2})?$

Useful for checking currency amounts, such 5 or 5.00 or 5.25

1 | 1.23 | 1234.45

alpha numeric

^[a-zA-Z0-9]+$

it will check for alphanumeric (Alpha Numeric) values.

adad1213 | 1231dfadfa | dfad123dfasdfs









ASCII Character Set











































Character Entity Number Entity Name Description
" " " quotation mark
' ' ' (does not work in IE) apostrophe 
& & & ampersand
< &#60; &lt; less-than
> &#62; &gt; greater-than



ISO 8859-1 Symbols:


















































































































































































































































Character Entity Number Entity Name Description
  &#160; &nbsp; non-breaking space
¡ &#161; &iexcl; inverted exclamation mark
¢ &#162; &cent; cent
£ &#163; &pound; pound
¤ &#164; &curren; currency
¥ &#165; &yen; yen
¦ &#166; &brvbar; broken vertical bar
§ &#167; &sect; section
¨ &#168; &uml; spacing diaeresis
© &#169; &copy; copyright
ª &#170; &ordf; feminine ordinal indicator
« &#171; &laquo; angle quotation mark (left)
¬ &#172; &not; negation
­ &#173; &shy; soft hyphen
® &#174; &reg; registered trademark
¯ &#175; &macr; spacing macron
° &#176; &deg; degree
± &#177; &plusmn; plus-or-minus 
² &#178; &sup2; superscript 2
³ &#179; &sup3; superscript 3
´ &#180; &acute; spacing acute
µ &#181; &micro; micro
&#182; &para; paragraph
· &#183; &middot; middle dot
¸ &#184; &cedil; spacing cedilla
¹ &#185; &sup1; superscript 1
º &#186; &ordm; masculine ordinal indicator
» &#187; &raquo; angle quotation mark (right)
¼ &#188; &frac14; fraction 1/4
½ &#189; &frac12; fraction 1/2
¾ &#190; &frac34; fraction 3/4
¿ &#191; &iquest; inverted question mark
× &#215; &times; multiplication
÷ &#247; &divide; division


ISO 8859-1 Characters:


















































































































































































































































































































































































































































Character Entity Number Entity Name Description
À &#192; &Agrave; capital a, grave accent
Á &#193; &Aacute; capital a, acute accent
 &#194; &Acirc; capital a, circumflex accent
à &#195; &Atilde; capital a, tilde
Ä &#196; &Auml; capital a, umlaut mark
Å &#197; &Aring; capital a, ring
Æ &#198; &AElig; capital ae
Ç &#199; &Ccedil; capital c, cedilla
È &#200; &Egrave; capital e, grave accent
É &#201; &Eacute; capital e, acute accent
Ê &#202; &Ecirc; capital e, circumflex accent
Ë &#203; &Euml; capital e, umlaut mark
Ì &#204; &Igrave; capital i, grave accent
Í &#205; &Iacute; capital i, acute accent
Î &#206; &Icirc; capital i, circumflex accent
Ï &#207; &Iuml; capital i, umlaut mark
Ð &#208; &ETH; capital eth, Icelandic
Ñ &#209; &Ntilde; capital n, tilde
Ò &#210; &Ograve; capital o, grave accent
Ó &#211; &Oacute; capital o, acute accent
Ô &#212; &Ocirc; capital o, circumflex accent
Õ &#213; &Otilde; capital o, tilde
Ö &#214; &Ouml; capital o, umlaut mark
Ø &#216; &Oslash; capital o, slash
Ù &#217; &Ugrave; capital u, grave accent
Ú &#218; &Uacute; capital u, acute accent
Û &#219; &Ucirc; capital u, circumflex accent
Ü &#220; &Uuml; capital u, umlaut mark
Ý &#221; &Yacute; capital y, acute accent
Þ &#222; &THORN; capital THORN, Icelandic
ß &#223; &szlig; small sharp s, German
à &#224; &agrave; small a, grave accent
á &#225; &aacute; small a, acute accent
â &#226; &acirc; small a, circumflex accent
ã &#227; &atilde; small a, tilde
ä &#228; &auml; small a, umlaut mark
å &#229; &aring; small a, ring
æ &#230; &aelig; small ae
ç &#231; &ccedil; small c, cedilla
è &#232; &egrave; small e, grave accent
é &#233; &eacute; small e, acute accent
ê &#234; &ecirc; small e, circumflex accent
ë &#235; &euml; small e, umlaut mark
ì &#236; &igrave; small i, grave accent
í &#237; &iacute; small i, acute accent
î &#238; &icirc; small i, circumflex accent
ï &#239; &iuml; small i, umlaut mark
ð &#240; &eth; small eth, Icelandic
ñ &#241; &ntilde; small n, tilde
ò &#242; &ograve; small o, grave accent
ó &#243; &oacute; small o, acute accent
ô &#244; &ocirc; small o, circumflex accent
õ &#245; &otilde; small o, tilde
ö &#246; &ouml; small o, umlaut mark
ø &#248; &oslash; small o, slash
ù &#249; &ugrave; small u, grave accent
ú &#250; &uacute; small u, acute accent
û &#251; &ucirc; small u, circumflex accent
ü &#252; &uuml; small u, umlaut mark
ý &#253; &yacute; small y, acute accent
þ &#254; &thorn; small thorn, Icelandic
ÿ &#255; &yuml; small y, umlaut mark

All Country List in a Dropdownlist c#

using System.Collections.Generic;
using System.Globalization;



Page_Load

{
PopulateCountryName(ddl_country);
}



private void PopulateCountryName(DropDownList dropDown)
{
Hashtable h = new Hashtable();

Dictionary<string, string > objDic = new Dictionary<string, string >();

foreach (CultureInfo ObjCultureInfo in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
{

RegionInfo objRegionInfo = new RegionInfo(ObjCultureInfo.Name);

if (!objDic.ContainsKey(objRegionInfo.EnglishName))
{
objDic.Add(objRegionInfo.EnglishName, objRegionInfo.TwoLetterISORegionName.ToLower());
}
}
List<KeyValuePair<string, string>> myList = new List<KeyValuePair<string, string>>(objDic);
myList.Sort(

delegate(KeyValuePair<string, string> firstPair,

KeyValuePair<string, string> nextPair)
{
return firstPair.Value.CompareTo(nextPair.Value);
}
);
foreach (KeyValuePair<string, string> val in myList)
{
dropDown.Items.Add(new ListItem(val.Key, val.Value));
}
}

Working with Accordion Pane

Working with Accordion Pane

In Registry:


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>





<cc1:Accordion ID="Accordion1" runat="server" SelectedIndex="0" Width="100%"
HeaderCssClass="accordionHeader" HeaderSelectedCssClass="accordionHeaderSelected"
ContentCssClass="accordionContent" FadeTransitions="false" FramesPerSecond="40"
TransitionDuration="250" AutoSize="None" RequireOpenedPane="false"
SuppressHeaderPostbacks="true">
<Panes>




<cc1:AccordionPane ID="AC" runat="server">
<Header>
<asp:Label ID = "lbl_PersonelDetails" Text = "Course Details" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" runat = "server"></asp:Label>
</Header>
<Content>

<table class="TAB_INNER">
<tbody><tr> <td>
Content I
</td>
</tr>
</tbody></table>
</Content>
</cc1:AccordionPane>

<cc1:AccordionPane ID="AD" runat="server" Width="100%">
<Header>
<asp:Label ID = "Label2" Text = "Department Details" Font-Bold="True"
Font-Names="Verdana" Font-Size="Small" runat = "server"></asp:Label>
</Header>
<Content>
<table class="TAB_INNER">
<tbody><tr> <td>
Content I
</td>
</tr>
</tbody></table>

</Content>
</cc1:AccordionPane>

</Panes>

</cc1:Accordion>