<script type="text/javascript"> $(document).ready(function () { var iBookCount = GetCount(); var pagesParam = { PanelId: 'pages', Count: iBookCount, PageSize: 10, AjaxFn: GetBookList }; var oPages = CreatePagesWidget(pagesParam); GetBookList(1); }); var searchvalue = ""; if ($("#searchtxt").val() != null) { searchvalue = $("#searchtxt").val(); $("#btnsearch").click(function () { GetSql(); }) } function GetSql() { $.getJSON('BookHandler1.ashx', { Searchtxt: searchvalue }, function (data) { $("#bookList").empty(); $.each(data, function (index, item) { $("#bookList").append('<li>' + item.BookName + '</li>'); }); }); } function GetCount() { var iCount = 0; $.ajaxSetup({ async: false }); $.get('BookHandler1.ashx', { Type: 'GetCount' }, function (data) { iCount = data; }); return iCount; } function GetBookList(pageIndex) { $.getJSON('BookHandler1.ashx', { PageIndex: pageIndex }, function (data) { $("#bookList").empty(); $.each(data, function (index, item) { $("#bookList").append('<li>' + item.BookName + '</li>'); }); }); } </script>