protected void GVSample_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Pager)
{
GridView gv = sender as GridView;
if (((Label)e.Row.FindControl("lbCurrentPage")).Text == "1")
{
((LinkButton)e.Row.FindControl("lbtnFirst")).Visible = false;
((LinkButton)e.Row.FindControl("lbtnPrev")).Visible = false;
}
if (((Label)e.Row.FindControl("lbCurrentPage")).Text == ((Label)e.Row.FindControl("lbTotalPage")).Text)
{
((LinkButton)e.Row.FindControl("lbtnNext")).Visible = false;
((LinkButton)e.Row.FindControl("lbtnLast")).Visible = false;
}
DropDownList ddl = ((DropDownList)e.Row.FindControl("ddlPages"));
for (int i = 1; i <= gv.PageCount; i++)
{
ListItem item = new ListItem();
item.Value = i.ToString();
item.Text = i.ToString();
ddl.Items.Add(item);
}
ddl.Items.FindByValue((gv.PageIndex + 1).ToString()).Selected = true;
}
}
相关文章:
-
2021-08-11
-
2022-12-23
-
2022-02-02
-
2022-01-27
-
2022-12-23
-
2021-11-11
-
2022-03-02
猜你喜欢
-
2021-06-15
-
2021-05-24
-
2021-09-15
-
2021-10-02
-
2021-11-21
-
2021-08-25
-
2021-11-21
相关资源
-
下载
2023-02-12
-
下载
2022-12-05
-
下载
2023-02-09