日期:2013-09-22  浏览次数:20740 次

using System;
using System.Collections;
using System.Configuration;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace cj168.Web
{
    /// <summary>
    /// Summary description for search.
    /// </summary>
    public class search : System.Web.UI.Page

    {
        protected System.Web.UI.WebControls.DataList datalistSearchResult;
        protected System.Web.UI.WebControls.Label lblTxtSearch;
        protected System.Web.UI.WebControls.Label lblRecordCount;
        protected System.Web.UI.WebControls.Label lblCurrentPage;
        protected System.Web.UI.WebControls.Label lblPageCount;
        protected System.Web.UI.WebControls.Label lblPageRange;

        protected System.Web.UI.WebControls.LinkButton lbnPrevPage;
        protected System.Web.UI.WebControls.LinkButton lbnNextPage;
        String txtSearch;
        int PageSize,RecordCount,PageCount,CurrentPage;
        

        public search()
        {
            Page.Init += new System.EventHandler(Page_Init);
        }

        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            txtSearch = Request.Params["txtSearch"];
            if (txtSearch != null )
            {txtSearch = txtSearch.Replace("'","");
            
            lblTxtSearch.Text = txtSearch;

            //设定PageSize
            PageSize = 10;

            //计算总共有多少记录
            RecordCount = CalculateRecord();
            lblRecordCount.Text = RecordCount.ToString();

            if(!Page.IsPostBack)

                {
                

                DoSearch();
                CurrentPage = 0;
   &n