[导入]DataGRID自定义分页样式
1
public void ItemCreated(object sender, DataGridItemEventArgs e)
2
{
3
ListItemType lit = e.Item.ItemType;
4
if (lit == ListItemType.Pager)
5
{
6
String strInitials;
7
8
TableCell pager = (TableCell) e.Item.Cells[0];
9
for(int i=0; i<pager.Controls.Count; i++)
10
{
11
object o = pager.Controls[i];
12
if (o is LinkButton)
13
{
14
strInitials = ((ArrayList)ViewState["PageMap"])[i/2].ToString();
15
LinkButton lb = (LinkButton) o;
16
lb.Text = " " + strInitials.ToUpper() + " ";
17
}
18
else
19
if (o is Label)
20
{
21
strInitials = ((ArrayList)ViewState["PageMap"])[i/2].ToString();
22
Label l = (Label) o;
23
l.Text = " " + strInitials.ToUpper() + " ";
24
l.Font.Bold = true;
25
l.Style["height"] = "20px;";
26
l.BackColor = grid.HeaderStyle.BackColor;
27
l.ForeColor = grid.HeaderStyle.ForeColor;
28![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
l.BorderWidth = 1;
30
l.Style["border-top"] = "gray outset 1px";
31
l.Style["border-left"] = "gray outset 1px";
32
l.Style["border-right"] = "gray outset 1px";
33
l.Style["border-bottom-color"] = "gray";
34
}
35
}
36
}
37
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
文章来源:http://www.cnblogs.com/suiqirui19872005/archive/2007/06/12/780552.html