Server Side Validation Class Class Name= validate.cs
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
/// <summary>
/// Summary description for validate
/// </summary>
public class validate
{
public validate()
{
}
public static IDictionary<string, Regex> RegexDictionary = new Dictionary<string, Regex>() {
{ "Phone", new Regex("\\d{10}")},
{ "Email", new Regex(@"^(([^<>()[\]\\.,;:\s@\""]+"
+ @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
+ @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
+ @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
+ @"[a-zA-Z]{2,}))$"
)},
{ "URL", new Regex(@"(http(s)?://)?([\w-]+\.)+[\w-]+(/[\w- ;,./?%&=]*)?")},
{ "ZipCode", new Regex("^[0-9]{6}$")}
};
public string IsPhoneValid(string phone)
{
if (!RegexDictionary["Phone"].IsMatch(phone))
{
// Phoneno should be digits only
return "Phoneno Must be of 10 digits only";
}
else
{
return "";
}
}
public string IsEmailValid(string email)
{
if (!RegexDictionary["Email"].IsMatch(email))
{
// EmailId is invalid
return "EmailId is invalid";
}
else
{
return "";
}
}
public string IsURLValid(string url)
{
if (!RegexDictionary["URL"].IsMatch(url))
{
// URL is invalid
return "URL is invalid";
}
else
{
return "";
}
}
public string IsZipCodeValid(string url)
{
if (!RegexDictionary["ZipCode"].IsMatch(url))
{
// ZipCode must be of 6 digit only.
return "ZipCode must be of 6 digit only.";
}
else
{
return "";
}
}
public string Minimuntwochar(string name)
{
Regex objAlphaPattern = new Regex("^[A-Za-z]{2,}$");
if (!objAlphaPattern.IsMatch(name))
{
// Minimum Two Characters.
return "Minimum Two Characters.";
}
else
{
return "";
}
}
public string Isnullorempty(String Controlname,string name)
{
if (string.IsNullOrEmpty(name))
{
return "Please Enter " + Controlname;
}
else
{
return "";
}
}
public string Compare(string controlname,string first,string second)
{
//Compare two field
if (!string.IsNullOrEmpty(first))
{
if (first == second)
{
return controlname + " accepted";
}
else
{
return controlname + " do not match.";
}
}
else
{
return controlname + " Cannot be Empty!.";
}
}
public string Isnumeric(string numeric)
{
Regex objnumeric = new Regex("^\\d+$");
if (!objnumeric.IsMatch(numeric))
{
// Minimum Two Characters.
return "Numeric Character only.";
}
else
{
return "";
}
}
public string Maxlength(string controlname,int maxlength, string controlvalue)
{
if (!String.IsNullOrEmpty(controlvalue))
{
if (controlvalue.Length!= maxlength)
{
return controlname + " Should not exceed the " + maxlength + " Character";
}
else
{
return "";
}
}
return "Please Enter " + controlname; ;
}
}
Control and label
<asp:TextBox ID="txtzipcode" runat="server"></asp:TextBox><asp:Label ID="lblzip"
runat="server"></asp:Label>
How To Use On Page
validate formvalidation = new validate();
lblzip.Text = formvalidation.IsZipCodeValid(txtzipcode.Text);
ASP.NET is a web application framework developed and marketed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language.
Wednesday, July 17, 2013
Tuesday, July 9, 2013
import excel data to sql server
First Create Table, it is better to name as sheet column name.
Then Copy the data [ Ctrl + C ]
Go to Table Right Click and select Open Table
Now left Click
The Area will be highlighted now right click and paste
Happy Excel ...data is in sql now..
Then Copy the data [ Ctrl + C ]
Go to Table Right Click and select Open Table
Now left Click
Happy Excel ...data is in sql now..
Friday, July 5, 2013
Web Developer Must Know
1) php.net : For Php information php.net is the best site.
2) Git hub : Very powerful repository where most of the majority of source code plug-ins, frameworks and libraries.
3) Stackoverflow.com : It has very big database of question answer.Most of the question are resolved here easily
4) net.tutsplus.com : It is a used for tutorial purpose here you can find the tutorial in all format that is audio, video and text.
5) jsfiddle.net. A very popular resource for testing JS, CSS, HTML. Here you can save the example and share the link with you friends.
6) fontsquirrel.com This site made very easy to generate font face.
7)lipsum.com and lorempixel.com. Two popular resources for filling and testing content. You can also generate text for different formats. The second one generates images by the subject and size.
8) prefixr.com This great resource is for anyone who bothers to put prefixes in their css code. It is very simple to use, just copy the code and resources will give re-generated code with prefixes.
9) caniuse.com This is an informative resource which contains information about certain technologies supporting browsers. It is always updated and the information is very useful for web developers who follow the trends.
10) css3generator.com This is a great generator for the majority of CSS3 styles. it offers a very easy and simple generator for those who do not remember the syntax.
2) Git hub : Very powerful repository where most of the majority of source code plug-ins, frameworks and libraries.
3) Stackoverflow.com : It has very big database of question answer.Most of the question are resolved here easily
4) net.tutsplus.com : It is a used for tutorial purpose here you can find the tutorial in all format that is audio, video and text.
5) jsfiddle.net. A very popular resource for testing JS, CSS, HTML. Here you can save the example and share the link with you friends.
6) fontsquirrel.com This site made very easy to generate font face.
7)lipsum.com and lorempixel.com. Two popular resources for filling and testing content. You can also generate text for different formats. The second one generates images by the subject and size.
8) prefixr.com This great resource is for anyone who bothers to put prefixes in their css code. It is very simple to use, just copy the code and resources will give re-generated code with prefixes.
9) caniuse.com This is an informative resource which contains information about certain technologies supporting browsers. It is always updated and the information is very useful for web developers who follow the trends.
10) css3generator.com This is a great generator for the majority of CSS3 styles. it offers a very easy and simple generator for those who do not remember the syntax.
DotnetNuke download free
DotnetNuke Its Free
DotNetNuke (DNN) is one of the leading Open Source web CMS apps for Microsoft ASP.NET, claiming it powers over 700,000 production websites worldwide. DNN offers a free version – the Community Edition – as well as two paid editions – Professional and Enterprise. A handy feature comparison chart is available on the DNN website.
Click here to download
You can also download this Community CMS from codeplex : download
Download DNN Skin : http://www.dnnskins.com
Dnn Tutorial : http://www.howiusednn.com/
Tuesday, July 2, 2013
Textbox as circle, Rectangle
<asp:TextBox ID="myoval" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Aplly CSS
<style>
#myoval {
width: 200px;
height: 200px;
border-radius: 213px 213px 213px 213px;
}
#TextBox1
{width: 400px;
height: 200px;
}
</style>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Aplly CSS
<style>
#myoval {
width: 200px;
height: 200px;
border-radius: 213px 213px 213px 213px;
}
#TextBox1
{width: 400px;
height: 200px;
}
</style>
Subscribe to:
Posts (Atom)















