Wednesday 11 September 2013

Make your own JQuery plugin


JQuery plugin :   

        (function ($) {
            $.fn.HelloWorld = function (e) {
                alert(e);
            }
        }(jQuery)); 

Use Plugin :
 
        $(document).ready(function () {
            $("#temp").HelloWorld("Test Plugin");
        })

Thursday 5 September 2013

Multicasting in Delegate



Multicast Delegates :
    Delegate multicast is that we can point more than one function at a time. A multicast delegate maintains a list of functions that will all be called when the delegate is invoked

    public class MyClassName
    {
        public delegate void delgName();
        public void main()
        {
            delgName dgt = new delgName(main1);
            dgt += new delgName(main2);
            dgt();
        }
        public void main1()
        {
        /// this will called first
        }
        public void main2()
        {
        /// this will called secondly
        }
    }