ASP. NET

Source: Internet
Author: User

Aspnetpager component

 

I. component parameters used

Total recordcount

Startrecordindex start Record Number (used in Stored Procedures)

Endrecordindex end record number (used in Stored Procedures)

Ii. Usage

Protected void page_load (Object sender, eventargs E)
{
If (session ["admin_user"] = NULL)
{
Response. Redirect ("login. aspx ");
Response. End ();
}
Else
{
Newssystem = new newssystem ();
Aspnetpager1.recordcount = newssystem. get_newsnum ();
}
}
Protected void aspnetpager1_pagechanged (Object sender, eventargs E)
{
Bindata ();
}
Public void bindata ()
{
Newssystem = new newssystem ();
News_list.datasource = newssystem. get_news (aspnetpager1.startrecordindex, aspnetpager1.endrecordindex );
News_list.databind ();
}

 

 

Attached stored procedure:

 

Alter procedure FY

(@ Startindex int,

@ Endindex int,

@ Docount INT)

As

Set nocount on

If (@ docount = 1)

Select count (*) from xt_article

Else

Begin

Declare @ indextable table (ID int identity (1, 1), nid int)

Set rowcount @ endindex

Insert into @ indextable (NID) Select ID from xt_article order by ID ASC

Select * From xt_article o, @ indextable t where O. ID = T. Nid

And T. ID between @ startindex and @ endindex order by T. ID

End

Set nocount off

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.