|
Forums » .NET » Windows »
|
Check box enable true or false in datagrid view of windows application |
Posted Date: 27 Jun 2012 Posted By:: divya Member Level: Silver Member Rank: 838 Points: 5
Responses:
1
|
I have data grid in windows application as mentioned below
ID Name Check1 Check2 Check3 AB0001 John False True False AB2461 Thomas False True False AB0002 Steve False False True AB0010 Robert False False True AB2467 Robert False False True in the above grid check1,2,3 are the check boxes,In this for each user i need to select only one check box. Note: If I selected Check1 for user1 then i need to disable check2 and check3 for this user.How can i do this in windows application
|
Responses
|
#677865 Author: sudhajosyula Member Level: Gold Member Rank: 46 Date: 28/Jun/2012 Rating:  Points: 4 | Hi divya, Use the below code and let me know if you encounter any errors or you if you stuck up...
protected void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { bool isChecked = (Boolean) dataGridView1[2, e.RowIndex].FormattedValue; if(isChecked == true) { dataGridView1[3, e.RowIndex].Value = false; dataGridView1[4, e.RowIndex].Value = false; } if(isChecked == false) { dataGridView1[3, e.RowIndex].Value = true; dataGridView1[4, e.RowIndex].Value = true; } } }
|
|
| Post Reply |
|
|
|
 | | This thread is locked for new responses. Please post your comments and questions as a separate thread. If required, refer to the URL of this page in your new post. |
|
|
|
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|