Click here to Skip to main content
15,888,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
in windows application , in dataGridView to find control button columns, since
i require to manipulate / change button enable / disable on certain condition.
Since find control is not available in windows application in dataGridView Control, what is the best alternative to do that

below is my code for dataGridView, here column 0 is DataGridViewButtonColumn

C#
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 0)
{


DataGridViewButtonColumn buttonCol = new DataGridViewButtonColumn();
}
}
Posted
Updated 19-Nov-12 0:20am
v2

C#
///For adding repository column in grid
DataGridViewButtonColumn ButtonColumn= new DataGridViewButtonColumn();
                ButtonColumn.HeaderText = "Button Column ";
                ButtonColumn.Text = "Click Me";
                ButtonColumn.Name = "btnClickMe";
                ButtonColumn.UseColumnTextForButtonValue = true;
                dataGridView1.Columns.Add(ButtonColumn); 

//Getting Events

dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {

                //StateMents you Want to execute to Get Data 
            }
        }
 
Share this answer
 
v2
You can loop the grid during binding and cast the control and datagridviewbutton column.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900