Posts

Showing posts from June, 2012

Calling Page Method

Today I will tell you how to call a page method using ajax request. AjaxRequest.aspx < script type ="text/javascript" src ="Scripts/jquery-1.7.2.js"></ script > < script type ="text/javascript">    $(document).ready( function ()    {        $( "#btnGetData" ).click( function ()     {          $.ajax({       type: "POST" ,       url: "AjaxRequest.aspx/GetData" ,       data: "{}" ,       contentType: "application/json; charset=utf-8" ,       dataType: "json" ,       success: function (msg) {       $( "#GetData" ).append(msg.d);       }     });   });   });     </ script > < div id ="Data">     To get data using ajax request click on this button. < br />     < input type ="button" id ="btnGetData" value ="Get Data" />         < div id ="GetData">         </ div >         </

How to use BlockUI

Image
Here I will tell you how can you block user interface.Sometimes you need to block user activity with page until a certain process is completed. Jquery provides us a very easy way to do that.All you need to do is download jquery library and BlockUI plugin file.Here is an example how to block user activity . < script src ="Scripts/jquery-1.7.2.js" type ="text/javascript"></ script >     < script src ="Scripts/BlockUI.js" type ="text/javascript"></ script >        < script type ="text/javascript">    $(document).ready( function () {     $( '#btnBlock' ).click( function () {         $.blockUI({         message: $( '#Block_div' ),         css:         {         padding: 0,         margin: 0,         textAlign: 'center' ,         fontSize: 12,         cursor: 'auto' ,         border: 'none' ,         background: 'none'         }      });    });    $( '#B