动态改变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.";
        }
    }
复制代码

posted on   王培  阅读(256)  评论(0编辑  收藏  举报

导航

< 2009年2月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
1 2 3 4 5 6 7
8 9 10 11 12 13 14
点击右上角即可分享
微信分享提示