Posts

Showing posts from October, 2015

Email ID Validation Using JavaScript Regular Expression

Source Code : < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title > Email ID Validation Using JavaScript Regular Expression. </ title > < script language ="javascript"> function ValidateEmailID(txtEmailID) { var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; if (txtEmailID.value == "" ) { txtEmailID.style.border = "" ; return true ; } else if (filter.test(txtEmailID.value)) { txtEmailID.style.border = "" ; return true ; } else { txtEmailID.style.borderColor = "red" ; return false ; } } </ script > </ head > < body > &l

Create your own captcha image generator in asp.net using c#.net

Create two pages GenerateCaptcha.aspx and Registration.aspx GenerateCaptcha.aspx <% @ Page Language ="C#" AutoEventWireup ="true" CodeFile ="GenerateCaptcha.aspx.cs" Inherits ="GenerateCaptcha" %> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns ="http://www.w3.org/1999/xhtml"> < head runat ="server"> < title ></ title > </ head > < body > < form id ="form1" runat ="server"> < div > </ div > </ form > </ body > </ html > GenerateCaptcha.aspx.cs using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Dra

Share Point List View to Excel using C#

Step 1: Create a visual webpart Step 2: Add a button to the webpart Step 3: Write the below code in button click event   Note: Only you have to pass  list name  and  view name , That’s it     protected   void  btnExport_Click( object  sender,  EventArgs  e)         {             SPSecurity.RunWithElevatedPrivileges( delegate ()             {                  using (SPSite site= new  SPSite(SPContext.Current.Web.Url))                 {                      using (SPWeb web=site.OpenWeb())                     {                         web.AllowUnsafeUpdates =  true ;                          string  values =  string .Empty;                         SPList list = web.Lists[ "List Name" ];                         SPView view = list.Views[ "List View Name" ];                         SPListItemCollection items = list.GetItems(view);                         DataTable dt =  new  DataTable();                         StringCollection