gpt4 book ai didi

c# - 如何在 Gridview 寻呼机中将 NextPageText/NextPageUrl 从 "..."更改为 "Next"?

转载 作者:太空宇宙 更新时间:2023-11-03 11:19:42 31 4
gpt4 key购买 nike

以下是我对 GridView 的分页器的标记

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

但是,当我运行它时,我得到默认的“...”作为导航到下一页和上一页的链接按钮。第一个和最后一个按钮导航链接按钮正确显示为图像。

谁能告诉我哪里出了问题?

编辑 1

我也用 NextPageText 得到相同的结果

最佳答案

我也遇到了同样的问题,我用这段代码解决了:

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 Pager 总是在下一个和上一个链接上呈现“...”。使用此代码,我将“...”替换为我的文本(如果您使用 FontsAwesome,也可以使用 HTML,如“”)

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";
}
}
}
}
}
}

关于c# - 如何在 Gridview 寻呼机中将 NextPageText/NextPageUrl 从 "..."更改为 "Next"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11429145/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com