Monday, August 4, 2014

Script To Disable Ctrl Keys Combination

<script  language="JavaScript">


 function disableCtrlKeyCombination(e) {
        //list all CTRL + key combinations you want to disable
        var forbiddenKeys = new Array('a', 'n', 'c', 'x', 'v', 'j', 'w','p','u');
        var key;
        var isCtrl;
        if (window.event) {
            key = window.event.keyCode;     //IE
            if (window.event.ctrlKey)
                isCtrl = true;
            else
                isCtrl = false;
        }
        else {
            key = e.which;     //firefox
            if (e.ctrlKey)
                isCtrl = true;
            else
                isCtrl = false;
        }
        //if ctrl is pressed check if other key is in forbidenKeys array
        if (isCtrl) {
            for (i = 0; i < forbiddenKeys.length; i++) {
                //case-insensitive comparation
                if (forbiddenKeys[i].toLowerCase() == String.fromCharCode(key).toLowerCase()) {
                    //alert('Key combination CTRL + ' + String.fromCharCode(key) + ' has been disabled.');
                    return false;
                }
            }
        }
        return true;
    }
</script>

How To Disable Print Copy Paste in Asp.net / HTML

<style type="text/css" media="print">
body { 

  display:none;
}
</style>

Wednesday, June 19, 2013

BULK DATA INSERT FROM CSV TO SQL SERVER

BULK INSERT TableBulkTest
FROM 'D:\BulkTest.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)

Monday, January 21, 2013

Insert data from One Table To another in SQL SERVER

insert into NEWTABLENAME (name,fathername) select name,fname from OLDTABLENAME


This Query user to copy data from one table to another, we can also use WHERE clause witth SELECT statement to verify data

Such as: 

insert into NEWTABLENAME (name,fathername) select name,fname from OLDTABLENAME
Where name IS NOT NULL

Friday, January 11, 2013

Add ScrollBar in CheckBox List in ASP.Net

It is not possible in Asp.Net but we can use by HTML TAG DIV


<divstyle="overflow-y:scroll; width:600px; height:500px">
</div>

Thursday, January 10, 2013

How To Use Split in Asp.net




 string[] arr=Txtname.Text.Split(new char[] {','});

Wednesday, January 2, 2013

how to delete file from folder in asp.net by FTP


 SqlDataAdapter da = new SqlDataAdapter("Select Path from Table_Image where loginID='" + TxtNo.Text + "'", connection);
        DataSet ds = new DataSet();
        da.Fill(ds);
        if (ds.Tables[0].Rows.Count > 0)
        {
         

            string host = "ftp://"; (Folder Path  Where image save)
            string userName = "uname";            (FTP User Name)
            string pwd = "password";             (FTP Password)
            string fileName = ds.Tables[0].Rows[0]["Path"].ToString();
            fileName = fileName.Replace("url", "");
            string remoteFile = Path.GetFileName(fileName);
            string FTPFilePath = Path.Combine(host, remoteFile);


            FtpWebRequest reqFTP = (FtpWebRequest)WebRequest.Create(FTPFilePath);
            reqFTP.Credentials = new NetworkCredential(userName, pwd);
            reqFTP.KeepAlive = false;
            reqFTP.UseBinary = true;
            reqFTP.UsePassive = false;
       
            reqFTP.Method = WebRequestMethods.Ftp.DeleteFile;

            FtpWebResponse resFTP =(FtpWebResponse)reqFTP.GetResponse();
           string desc=resFTP.StatusDescription;
}