Add Read More note with web site link When Someone Copies Text from your website.


Below code use full when you want to add your link when some one copy from your website.

Put below java script code in main Master page.

function addLink() {
    //Get the selected text and append the extra info
    var selection = window.getSelection();
    pagelink = ". Read more at: " + document.location.href;
    copytext = selection + pagelink;
 //Create a new div to hold the prepared text
    newdiv = document.createElement('div');

    //hide the newly created container = 'absolute'; = '-99999px';

    //insert the container, fill it with the extended text, and define the new selection
    newdiv.innerHTML = copytext;

    window.setTimeout(function () {
    }, 100);
document.addEventListener('copy', addLink);

Hope this will help.

Posted in | 0 comments

Format JSON Date.


Below is way to format JSON Date.

var date = new Date(parseInt(jsonDate.substr(6)));

The substr function takes out the "/Date(" part, and the parseInt function gets the integer and ignores the ")/" at the end. The resulting number is passed into the Date constructor.

if you are using newtonsoft then see at below location.

Posted in | 0 comments

How to bind Event on dynamically created elements in JQuery.

We can achieve this using jQuery.fn.on.  
(Details document available at

Let’s have an example.

Suppose your page creating element with the class name 'Applyevent'
you would bind the event to a parent which already exists
mainly 'document'

$(document).on('mouseover', '.Applyevent', function(){

    // what you want to happen when mouseover 

    // occurs on elements that match '.Applyevent'


Any parent that exists at the time the event is bound is fine. For example

$('.dynamicgenerate').on('click', 'button', function(){

    // code here


<div class="dynamicgenerate">


              <---- Dynamic Controls here ---->

              --- Suppose <button>


Posted in Labels: | 0 comments

How to remove specific session in

You can set session element to null.


Session["sessionname"] = null;

Posted in | 0 comments

How to parse html in C#?


You Can use Html Agility Pack
Details is availbale at

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).


using Fizzler that takes a jQuery/Sizzler approach to selecting HTML elements. It's based on HTML Agility Pack.Details available at below location.

Posted in | 0 comments