protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.DataItem != null) { //System.Diagnostics.Debug.WriteLine(e.Row.DataItem.ToString()); System.Data.DataRowView drv = (System.Data.DataRowView)e.Row.DataItem; string id=idrv["id"].ToString(); //id是绑定到该GridView1的数据表字段名 CheckBox ck1=(CheckBox)e.Row.FindControl("CheckBox1"); //访问用户自定义控件的方法 } }