DataGrid Control-Add title pagination

Source: Internet
Author: User
Private   Void Dgdoubleheader_itemcreated ( Object Sender, system. Web. UI. webcontrols. datagriditemeventargs E)
{
// Obtain the type of items in the DataGrid Control.
Listitemtype itemtype = E. Item. itemtype;
// Determine whether a page navigation item is used
If (Itemtype = Listitemtype. pager)
{
// Determine if it is the first navigation item
If (Uppager)
{
// Define a Cell Object Based on the items in the DataGrid Control
Tablecell cellpersonal = (Tablecell) E. Item. controls [ 0 ];
// Removes all controls from the cell.
Cellpersonal. Controls. Clear ();
// Set the background color of a cell object
Cellpersonal. backcolor = Color. Orange;
// Set the foreground color of a cell object
Cellpersonal. forecolor = Color. Black;
// Set this cell object to span 3 columns
Cellpersonal. columnspan =   2 ;
// Set the align mode of the Cell Object to center
Cellpersonal. horizontalalign = Horizontalalign. Center;
// Add text content in Cells
Cellpersonal. Controls. Add ( New Literalcontrol ( " Name " ));
// Define cell objects
Tablecell cellwork =   New Tablecell ();
// Set the background color of a cell object
Cellwork. backcolor = Color. orangered;
// Set the foreground color of a cell object
Cellwork. forecolor = Color. Black;
// Set this cell object to span two columns
Cellwork. columnspan =   3 ;
// Set the align mode of the Cell Object to center
Cellwork. horizontalalign = Horizontalalign. Center;
// Add text content in Cells
Cellwork. Controls. Add ( New Literalcontrol ( " Contact info " ));
// Add a cell object to the control set of this item
E. Item. Controls. Add (cellwork );
// Change pager flag
Uppager =   False ;
}
}

}

Private   Void Dgdoubleheader_pageindexchanged ( Object Source, system. Web. UI. webcontrols. datagridpagechangedeventargs E)
{
// Change the value of the pager flag so that it can set the title header each time a paging event is triggered.
Uppager =   True ;
// Set the new page index value
Dgdoubleheader. currentpageindex = E. newpageindex;
// Rebind data
Datagriddatabind ();
}

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.