gridview小把戏

点击任意行触发事件

protected void GridView1_Load(object sender, EventArgs e)
    {
        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            string ok = this.GridView1.Rows[i].Cells[0].Text;
            this.GridView1.Rows[i].Attributes.Add("onclick", "javascript:alert('" + ok + "');");
        }
    }

欢迎拍砖,欢迎转载,欢迎关注,欢迎联系,就是各种欢迎
原文地址:https://www.cnblogs.com/EddyPeng/p/1225880.html