Customize datagrid Page bar

V

viktor9990

I'm showing data in a datagrid with built in pagination. I want to show on
each page 100 records(pagesize = 100) so that the page barwill look like
[1-100][101-200][201-300][301-400]...), but managed only to do it
like([1][2][3]...). Any help is appreciated.
Here is my code:

public void NewPageIndex(object sender, DataGridPageChangedEventArgs e)
{
DataGrid_ExtCommMeasPoints.CurrentPageIndex = e.NewPageIndex;
BindDataGridInfo();
}


public void ItemCreated(Object sender, DataGridItemEventArgs e)
{
ListItemType lit = e.Item.ItemType;
if (lit == ListItemType.Pager)
{
TableCell pager = (TableCell) e.Item.Controls[0];
for(int i=0; i {
Object o = pager.Controls;
if (o is LinkButton)
{
LinkButton lb = (LinkButton) o;
int myIndex = Convert.ToInt32(lb.Text);
string nyIndex = myIndex.ToString();
lb.Text = "[" + nyIndex + "]";
}
else
if (o is Label)
{
Label l = (Label) o;
int myIndex = Convert.ToInt32(l.Text);
string nyIndex = myIndex.ToString();
l.Text = "[" + nyIndex + "]";
l.Font.Bold = true;
}

}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top