如题,请各位大侠帮帮忙

解决方案 »

  1.   

    在绑定事件里面进行就可以了,e.Row.FindControl可以找到任何控件
      

  2.   

            private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
                try
                {
                    if(e.ColumnIndex==2)        //判断是否为LinkButton列
                    {
                        foreach(DataGridViewRow dgr in dataGridView1.Rows)
                        {
                            DataGridViewLinkCell cell = (DataGridViewLinkCell)dgr.Cells[2];
                            object val = cell.FormattedValue;         //获取连接值                         //这里进行你的数据库操作
                             。。
                        }
                        
                    }
                }
                catch(Exception ex)
                {            }
            }
        }