c# - How to know a specific checkbox inside datagridview is checked or not? -
i had gridview has 2 columns , 1 textbox column , other checkbox column, how know checkbox checked .
as shown in image ,suppose of checkbox checked , want display corresponding text box value checkbox.
can me?i tried below code , problem facing , values getting displayed once clicked next checkbox checked checkbox values getting displayed..
datagridview1.cellvaluechanged += new datagridviewcelleventhandler(datagridview1_cellvaluechanged); void datagridview1_cellvaluechanged(object sender, datagridviewcelleventargs e) { object tempobj = datagridview1.rows[e.rowindex].cells[1].value; datagridview1_currentcelldirtystatechanged(sender, e); if (((e.columnindex) == 1) && ((bool)datagridview1.rows[e.rowindex].cells[1].value)) { messagebox.show(datagridview1.rows[e.rowindex].cells[0].value.tostring()); } }
private void datagridview1_currentcelldirtystatechanged(object sender, eventargs e) { if (datagridview1.iscurrentcelldirty) { datagridview1.commitedit(datagridviewdataerrorcontexts.commit); } } private void datagridview1_cellvaluechanged(object sender, datagridviewcelleventargs e) { if (((e.columnindex) == 1) && ((bool)datagridview1.rows[e.rowindex].cells[1].value)) { messagebox.show(datagridview1.rows[e.rowindex].cells[0].value.tostring()); } }
these below links helped me understand concept of cellvalue_changed , cell_content_click.. http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.cellvaluechanged.aspx
and of these links got solution problem
Comments
Post a Comment