Friday, October 15, 2010

code for using Jquery in asp.net

 protected override void Render(HtmlTextWriter writer)
    {
        this.Page.ClientScript.RegisterClientScriptInclude("jQuery", "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js");
        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "startup", "");
        base.Render(writer);
    }

Jquery

       function test_alert()     {     $("#sample").animate({width: "70%",opacity: "0.4",marginLeft: "0.6in",fontSize: "3em",      borderWidth: "10px"}, 1500 );     //alert('Proceed to hide the message');     $("#sample").hide(3000,function () {     $(this).show(5000, function () {     $(this).slideUp(10000,function() {     $(this).slideDown(1000);        });     });     });     });     }     function helloWorld()     {         $("#sample").append("Hello World!!");          $("#sample").click(test_alert);          $("#sample").removeClass("bgcolor").addClass("newcolor");          $("#p:first").fadeTo("slow",0.33);             }