ต้องการกำหนดหมายเลขหน้าโดยให้ใช้ฟอนต์ที่ใหญ่กว่าเดิมหรือใช้สีที่ต่างไปจากเดิม
ทำได้โดยใช้
RowDataBound event ใน
GridView และใช้รูปแบบอัตโนมัติ
ดังตัวอย่างด้านล่างนี้
protected void
GridView1_RowDataBound(object sender,
GridViewRowEventArgs e)
{
if (e.Row.RowType
== DataControlRowType.Pager)
{
TableRow row
= e.Row.Controls[0].Controls[0].Controls[0]
as TableRow;
foreach
(TableCell cell in row.Cells)
{
Control lb
= cell.Controls[0]
;
if
(lb is Label)
{
((Label)lb).ForeColor
= System.Drawing.Color.Red;
((Label)lb).Font.Size
= new FontUnit("40px");
}
else
if (lb is
LinkButton)
{
//Here is for changing the rest LinkButton page number.
}
}
}
}
Supa Sethasiripong [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.