Monday, 12 August 2013

Encript Web.config file using asp.net c#

Step-1 -Run VS as administrator
   
protected void btn_encriptConfig_Click(object sender, EventArgs e)
    {      
        Encryption(true);
    }

    protected void Encryption(bool EncryptoValue)
    {

        Configuration config =WebConfigurationManager.OpenWebConfiguration("~");
        ConfigurationSection sec = config.GetSection("connectionStrings");
        if (EncryptoValue == true)
        {
            sec.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
        }
        else
        {
            sec.SectionInformation.UnprotectSection();
        }
        config.Save();
    }

Thursday, 8 August 2013

Disable all control inside a div using javascript

 <script>
         function disableDiv(){
            document.getElementById("testdiv").disabled = true;
            var nodes = document.getElementById("testdiv").getElementsByTagName('*');
            for(var i = 0; i < nodes.length; i++){
                nodes[i].disabled = true;
            }
         }    
</script>

html
<div id="testdiv">

//your controls here !

</div>

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...