我也得到了同样的问题,我用这个代码解决:
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寻呼机总是在next和prev链接上渲染“...”。有了这个代码,我取代的 “...” 我的文本(也可以使用HTML像 “< I类= '发FA-LG FA-角度左' > < /李>” 如果你使用FontsAwesome)
代码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";
}
}
}
}
}
}
你为什么不使用['NextPageText'(http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.pagersettings.nextpagetext.aspx) ? – balexandre 2012-07-11 09:07:14
谢谢你提醒我;我忘了提及我也试过,但我得到了同样的结果。 – 2012-07-11 09:14:27
是否有可能在代码中设置“...”?这可能会导致'NextPageText ='Next''被覆盖。 – nunespascal 2012-07-11 09:19:02