gentle做的分页控件

1、自己定义控件本身
  1using System;
  2using System.Collections.Generic;
  3using System.Text;
  4using System.Web.UI;
  5using System.Web.UI.WebControls;
  6using System.Web.UI.HtmlControls;
  7using System.Drawing;
  8using System.Collections;
  9using System.Collections.Specialized;
 10using System.ComponentModel;
 11using System.Data;
 12
 13using Gentle.Framework;
 14/// -----------------------------------------------------------------------------
 15/// Project     : CtrolBox
 16/// Class     : PagerCtl///          
 17/// -----------------------------------------------------------------------------
 18/// <summary>
 19/// gentle分页
 20/// </summary>
 21/// <remarks>
 22/// </remarks>
 23/// <history>
 24///     xx. YYYY/MM/DD   VER     AUTHOR      COMMENTS        
 25///      1. 2007/2/2     1.00    susan       CREATE
 26/// </history>
 27/// -----------------------------------------------------------------------------

 28
 29namespace CtrolBox
 30{
 31    [assembly: WebResource(CtrolBox.PagerCtl.CSSResName, "text/css")]
 32    [assembly: WebResource(CtrolBox.PagerCtl.JSResName, "text/javascript")]
 33
 34    public class PagerCtl: WebControl, INamingContainer, IPostBackDataHandler
 35    {
 36        内部属性
 49
 50        属性
117
118        公开事件
199
200        内部function
230
231        实现
402    }

403}

404
2、Calendar.js
///判断当前页
function fn_Check(currpage,allpages,flg){
    currpage
=parseInt(currpage.value.trim());
    allpages
=parseInt(allpages);
    
switch(flg){
        
case "F":
            
if(currpage==1){
                alert(
"It is the first page");
                
return false;
            }
else{
                
return true;
            }

            
break;
        
case "P":
            
if(currpage-1<=1){
                alert(
"It is the first page");
                
return false;
            }
else{
                
return true;
            }

            
break;
        
case "L":
            
if(currpage>=allpages){
                alert(
"It is the last page");
                
return false;
            }
else{
                
return true;
            }

            
break;
        
case "N":
            
if(currpage+1>=allpages){
                alert(
"It is the last page");
                
return false;
            }
else{
                
return true;
            }

            
break;
        
case "G":
            
if(currpage>allpages||currpage<1){
                alert(
"No page");
                
return false;
            }
else{
                
return true;
            }

            
break;
    }

    
return true;
}
3、Calendar.css
.button
{
    
/*参考button样式--huiqin*/
    FILTER
: progid:DXImageTransform.Microsoft.Gradient(startColorStr='white', endColorStr='aliceblue', gradientType='0');
    COLOR
: #333333;
    FONT-FAMILY
: verdana;
    FONT-SIZE
: 9pt;
    border
: 1px solid aliceblue;
}

.textbox
{
    background
:#ffffff;
    border-bottom-color
:#CCCCCC;
    border-bottom-width
:1px;
    border-top-width
:1px;
    border-left-width
:1px;
    border-right-width
:1px;
    
/*color:Gray;*/
    text-decoration
:none;/*文本样式*/
    word-spacing
:inherit;/*字间距离*/
    font-size
: 10pt; font-style:normal;
    font-family
:"宋体,Tahoma";bottom:0px;
    height
: 15px;/*文本框高度*/
    width
:30px;/*文本框宽度*/
    line-height
: normal
}
4、测试,调用
protected void Page_Load(object sender, EventArgs e)
{
    
if (!this.IsPostBack)
    
{
        
this.PagerCtl.Sql = " select * from dbo.m_Units ";
        
this.GridView1.DataSource = this.PagerCtl.DataSource;
        
this.GridView1.DataBind();
    }

}

protected void PagerCtl_btnClick(object sender, EventArgs e)
{
    
this.GridView1.DataSource = this.PagerCtl.DataSource;
    
this.GridView1.DataBind();
}

posted on 2007-02-02 12:57  freeliver54  阅读(811)  评论(5编辑  收藏  举报

导航