日期:2009-11-08  浏览次数:20435 次

using System;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.ComponentModel;




using System.Text;



namespace NSLzhPages

{



public class LzhPages : System.Web.UI.WebControls.WebControl

{

private int _count;//每页显示的记录条数

private int _currentPage;//当前页

private int _allCount;//所有记录条数

private int _showPages;//显示页数



//以下脚本用于从文本框输入页码

private const string SCRIPTSTRING = "<script language='javascript'>\n" +

" function go(ctrl,max)\n" +

" {\n" +

" if(ctrl.value >= 1 && ctrl.value <= max)\n" +

" {\n" +

" var url;\n" +

" var index;\n" +

" url = location.href;\n" +

" index = url.indexOf('?');\n" +

" if(index == -1)\n" +

" {\n" +

" }\n" +

" else\n" +

" {\n" +

" url = url.substring(0,index);\n" +

" }\n" +

" location.href = url + '?currentPage=' + ctrl.value;\n" +



" }\n" +

" else\n" +

" {\n" +

" alert('您输入的页码必须是符合页面要求的数字,最大值是:' + max);\n" +

" return false;\n" +

" }\n" +

" }\n" +

"</script>\n";





[DefaultValue(10),Category("Customer")]

public int Count

{

set

{

if(value <= 0)

_count = 1;

else

_count = value;

}

get

{

return _count;

}

}



[DefaultValue(1),Category("Customer")]

public int CurrentPage