2

The following is my markup for a GridView's pager

<PagerSettings Mode="NumericFirstLast" PageButtonCount="3" 
    FirstPageImageUrl="~/images/First.jpg" 
    LastPageImageUrl="~/images/Last.jpg" 
    NextPageImageUrl="~/images/Next.jpg" 
    PreviousPageImageUrl="~/images/Prev.jpg" />

However when I run it I get the default "..." as a link button to navigate to the next and previous pages. The first and last button navigation link buttons are shown as images properly.

Could someone tell me what's wrong?

EDIT 1

I get the same results with NextPageText as well

4

1 回答 1

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 寻呼机总是在下一个和上一个链接上呈现“...”。使用此代码,我将“...”替换为我的文本(如果您使用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";
                    }
                }
            }
        }
    }
}
于 2016-08-16T14:25:18.480 回答