动态改变GridView中EmptyDataTemplate的值
// 根据查询条件,更换Empty提示
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.EmptyDataRow)
{
Label lblEmptyShow = (Label)GridView1.Controls[0].Controls[0].FindControl("lblEmptyShow"); //第一层Control是Table,第二层Control是Row
lblEmptyShow.Text = "Sorry, there are no new leaveword now.";
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.EmptyDataRow)
{
Label lblEmptyShow = (Label)GridView1.Controls[0].Controls[0].FindControl("lblEmptyShow"); //第一层Control是Table,第二层Control是Row
lblEmptyShow.Text = "Sorry, there are no new leaveword now.";
}
}
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步