I have this method to build the Paging numbers for a datagrid since for some reason the collection containing the page numbers is not in perfect sequence e.g.
1 2 3 4 5 6 7 8 9 10 11 12 13 32 33 34 35 36 14 15 16 ....
- debugging showed that the ItemCreated event for Pagers is being invoked more than once.
The method I am using overrides the above problem, listing the page numbers in perfect sequence. However I am having trouble finding out how to put spaces in between the numbers... right now the output I generate is like this:
12345678910111213141516171819.....to last page number.
How can I put an "nbsp;" or blank value between the page numbers?
My code which is in the ItemCreated event is below:
if (e.Item.ItemType == ListItemType.Pager)
{
TableCell pager = (TableCell) e.Item.Controls[0];
TableCell newPager = new TableCell();
newPager.ColumnSpan = 99;
// Move the controls from the old Pager to the new Pager
for (int i = 0; i < (pager.Controls.Count); i++)
{
newPager.Controls.AddAt(i, pager.Controls);
}
// Remove the old Pager bar
e.Item.Controls.RemoveAt(0);
// And add the new one
e.Item.Controls.AddAt(0, newPager);
}
Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 32 33 34 35 36 14 15 16 ....
- debugging showed that the ItemCreated event for Pagers is being invoked more than once.
The method I am using overrides the above problem, listing the page numbers in perfect sequence. However I am having trouble finding out how to put spaces in between the numbers... right now the output I generate is like this:
12345678910111213141516171819.....to last page number.
How can I put an "nbsp;" or blank value between the page numbers?
My code which is in the ItemCreated event is below:
if (e.Item.ItemType == ListItemType.Pager)
{
TableCell pager = (TableCell) e.Item.Controls[0];
TableCell newPager = new TableCell();
newPager.ColumnSpan = 99;
// Move the controls from the old Pager to the new Pager
for (int i = 0; i < (pager.Controls.Count); i++)
{
newPager.Controls.AddAt(i, pager.Controls);
}
// Remove the old Pager bar
e.Item.Controls.RemoveAt(0);
// And add the new one
e.Item.Controls.AddAt(0, newPager);
}
Thanks!