我也遇到了同样的问题,我用这段代码解决了:
Protected Sub grdPatsCliente_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles grdPatsCliente.RowCreated
If e.Row.RowType = DataControlRowType.Pager Then
Dim i As Integer = 0
For Each ctl As Control In e.Row.Cells(0).Controls(0).Controls(0).Controls
i += 1
If ctl.Controls(0).GetType.ToString = "System.Web.UI.WebControls.DataControlPagerLinkButton" Then
Dim lnk As LinkButton = CType(ctl.Controls(0), LinkButton)
If lnk.Text = "..." Then
If i < 3 Then
lnk.Text = "Prev"
Else
lnk.Text = "Next"
End If
End If
End If
Dim x As String = ctl.ClientID
Next
End If
End Sub
默认的 Gridview 寻呼机总是在下一个和上一个链接上呈现“...”。使用此代码,我将“...”替换为我的文本(如果您使用FontsAwesome ,也可以使用 HTML,例如“<i class='fa fa-lg fa-angle-left'></li>” )
代码 C#:
protected void grdPatsCliente_RowCreated(object sender, GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.Pager) {
int i = 0;
foreach (Control ctl in e.Row.Cells[0].Controls[0].Controls[0].Controls) {
i++;
if (ctl.Controls[0].GetType().ToString() == "System.Web.UI.WebControls.DataControlPagerLinkButton") {
LinkButton lnk = (LinkButton)ctl.Controls[0];
if (lnk.Text == "...") {
if (i < 3) {
lnk.Text = "Prev";
} else {
lnk.Text = "Next";
}
}
}
}
}
}