Custom Control gridtable for paging Effect

Source: Internet
Author: User

Recently, a project requires a display control with the paging function. The gridview control is powerless because of the large data volume. Therefore, I wrote a page display control gridtable that supports a large amount of data (of course, the massive data query algorithm needs to be done by myself). The control inherits repeater.

The data source of the control does not use datasource to assign values. Instead, it implements an internal delegate "objectperformancebindeventhandler (INT startcount, int endcount)". This method defines two variables: the start row number and the end row number of the result set, returns a result set object to implement the paging function. The effect is as follows:

 

Part of the aspx File Code

Aspx code <Wc1: gridtable id = "grid1" runat = "server" bannertextformat = "{0} per page/{1} in total & nbsp; page {2}/{3} in total"
Pagesize = "5" bannercls = "bannercls" pagerposition = "both" paginationcls = "pagind"
Pageimgbturl = "btn4.gif" allowpaging = "true">
<Pagetemplate>
<H1>
Pagetemplate show </Pagetemplate>
<Headertemplate>
<DL class = "briefresult">
</Headertemplate>
<Itemtemplate>
<DT>
<a href = "#"> <% # eval ("name ") %> </a>
<Span> Health Preserving Yangsheng </span> </DT>
<DD>
<% # Eval ("info") %>
</DD>
<Dd class = "more">
<A href = "#"> read the full text >></A> </DD>
</Itemtemplate>
<Footertemplate>
</Dl> </footertemplate>
<Emptydatatemplate>
<H1>
Emptydata </Emptydatatemplate>
</Wc1: gridtable>

Backend. CS

. CS code Protected void page_load (Object sender, eventargs E)
{
Grid1.objectperformancebind + = new TPI. Web. UI. webcontrols. gridtable. objectperformancebindeventhandler (grid=objectperformancebind );
If (! Ispostback)
{
Grid1.databind ();
}
}

Object grid1_objectperformancebind (INT startcount, int endcount)
{
......
Return DT;
}

Insufficient

1. Because the repeater is inherited, all styles must be defined by themselves (it is troublesome to create tables)

2. There is no Ajax method to flip the page (I hope the experts will give you some advice on how to implement it without using updatepannel)

3. Simple functions, which need further improvement

 

You are welcome to publish the Code. If you have any good suggestions, please kindly advise me.

 

Source code download

 

 

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.