This is a migrated thread and some comments may be shown as answers.

gridviewcheckboxcolum cell clicked event is not fired

1 Answer 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SachinC
Top achievements
Rank 1
SachinC asked on 21 Sep 2010, 09:10 AM
Hi,

i hav a radgridview and a gridviewcheckboxcolumn in it.
when i click on checkbox why cell click event if not fired for checkbox.
or what is the other way to handle this checkbox checked event in gridview.

currently i am using Mouse Click event but there is one problem with it

 

 

 

 

Private Sub gridViewHome_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles gridViewHome.MouseClick 
   
  
Dim element As RadElement = Me.gridViewHome.ElementTree.GetElementAtPoint(e.Location) 
   
If TypeOf element Is RadCheckmark Then 
   
If (IsNothing(gridViewHome.Rows(gridViewHome.CurrentRow.Index).Cells("User").Value)) Then 
   
RadMessageBox.Show("Task Cannot Assign/UnAssign if the task", "Cannot Assign/UnAssign Task", MessageBoxButtons.OK, RadMessageIcon.Info) 
   
End If 
   
End If 
   
End Sub

when i click on the checkbox the mouse click event is fired and message box is also shown and after that when i click on Ok Button of Mesaage Box. the CheckBox is "Checked"
i dont this the Checked if the condition is satisfied.

please suggest.

Thanks

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Siingh
Top achievements
Rank 2
answered on 21 Sep 2010, 10:01 AM
Use this


Private Sub RadGridView1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGridView1.ValueChanged
        Dim editor As RadCheckBoxEditor = TryCast(sender, RadCheckBoxEditor)
 
        If editor IsNot Nothing Then
            Dim dataRow As GridViewDataRowInfo = DirectCast(Me.RadGridView1.CurrentRow, GridViewDataRowInfo)
            Dim dataColumn As GridViewDataColumn = DirectCast(Me.RadGridView1.CurrentColumn, GridViewDataColumn)
            'CheckChildRows(dataRow, CBool(editor.Value))
            RadGridView1.Rows(dataRow.Index).Cells("CheckboxColumn").Value = CBool(editor.Value)
        End If
 
    End Sub
Tags
GridView
Asked by
SachinC
Top achievements
Rank 1
Answers by
Siingh
Top achievements
Rank 2
Share this question
or