以下是我对GridView寻呼机的标记
<PagerSettings Mode="NumericFirstLast" PageButtonCount="3"
FirstPageImageUrl="~/images/First.jpg"
LastPageImageUrl="~/images/Last.jpg"
NextPageImageUrl="~/images/Next.jpg"
PreviousPageImageUrl="~/images/Prev.jpg" />
然而,当我运行它时,我得到默认的“...”作为链接按钮,以导航到下一页和上一页。第一个和最后一个按钮导航链接按钮正确显示为图像。
有人能告诉我出了什么问题吗?
编辑1
我也可以使用NextPageText获得相同的结果
答案 0 :(得分:2)
我也遇到了同样的问题,我用这段代码解决了:
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链接上呈现“...”。使用此代码,我将“...”替换为我的文本(如果使用{{也可以使用类似“&lt; i class ='fa fa-lg fa-angle-left'&gt;&lt; / li&gt;”的HTML) 3}})
代码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";
}
}
}
}
}
}