动态改变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.";
        }
    }
原文地址:https://www.cnblogs.com/wangpei/p/1390056.html