AspNetPager分页控件

<webdiyer:AspNetPager ID="AspNetPager1" runat="server" CustomInfoHTML="每页显示 <input type='text' style='width:30px;' readonly='true' value='%PageSize%' class='input_text' style='text-align:center'/> 条 当前 %CurrentPageIndex%/%PageCount% 页 共 %RecordCount% 条记录&nbsp;&nbsp;"  ShowCustomInfoSection="Left" Width="500px" FirstPageText="首页" LastPageText="尾页" LayoutType="Table" NextPageText="下一页" PrevPageText="上一页" ShowPageIndex="False" CustomInfoTextAlign="Right" HorizontalAlign="Right" PageSize="5" SubmitButtonText="Go" CssClass="left_title_footer" PageIndexBoxClass="input_text1" PageIndexBoxType="TextBox" ShowPageIndexBox="Always" SubmitButtonClass="input_button" TextAfterPageIndexBox="&amp;nbsp;页&amp;nbsp;" TextBeforePageIndexBox="转到&amp;nbsp;" PageIndexBoxStyle="text-align:center">
</webdiyer:AspNetPager>





protected void Page_Load(object sender, EventArgs e)
    {
        //获取数据记录数
        AspNetPager1.RecordCount = GetPageCount;
    }

//PageChanged事件
protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        DataBind();
    }



-- =============================================
-- Author:		DylanChan
-- Create date: 2010.12.21 21:23
-- Description:	获取表的记录数
-- =============================================
CREATE PROCEDURE [procGetCount]
@tableName varchar(50),
@condition varchar(1000)='1=1'
AS
BEGIN
declare @SQL varchar(1000)
set @SQL = 'select count(*) from [' + @tableName + '] where ' + @condition
print(@SQL)
exec(@SQL)
END

exec procGetCount '表名','条件'


-- =============================================
-- Author:		DylanChan
-- Create date: 2010.12.21 20:30
-- Description:	获取分页数据
-- =============================================
CREATE PROCEDURE [procGetPager]
@startIndex int,
@pageSize int,
@tableName varchar(50),
@condition varchar(1000)='1=1',
@primaryKey varchar(50),
@orderType varchar(20)
AS
BEGIN
declare @SQL varchar(1000)
set @SQL = 'select top ' + str(@pageSize) + ' * from [' + @tableName + '] where ' + @condition + ' and ' + @primaryKey + ' not in (select top ' + str(@startIndex) + ' ' + @primaryKey + ' from [' + @tableName + '] where ' + @condition + ' order by ' + @primaryKey + ' ' + @orderType + ') order by ' + @primaryKey + ' ' + @orderType
print(@SQL)
exec(@SQL)
END

你可能感兴趣的:(sql,C++,c,C#,Go)