Hi,
I need to know the name of the sender's column in a GridView. The below code in WinForms Q2 2010 SP2 doesn't work. The code is:
In the previous code the column named "Devol" is GridviewCheckBoxColumn and "DaysDefDev" is a numeric column. When I check or uncheck "Devol" column an exception occurs with the message like "Can't cast from 'Telerik.WinControls.UI.RadCheckBoxEditor' to 'Telerik.WinControls.UI.GridDataCellElement'."
If I type TryCast insted of CType the object is always nothing and another exception is thrown.
Any help would be great.
Thanks.
I need to know the name of the sender's column in a GridView. The below code in WinForms Q2 2010 SP2 doesn't work. The code is:
Private Sub Grid_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Grid.ValueChanged Dim dce As GridDataCellElement dce = CType(sender, GridDataCellElement) If dce.ColumnInfo.Name = "Devol" Then If Grid.CurrentRow.Cells("Devol").Value Then Grid.CurrentRow.Cells("DaysDefDev").ReadOnly = False Else Grid.CurrentRow.Cells("DaysDefDev").ReadOnly = True Grid.CurrentRow.Cells("DaysDefDev").Value = 0 End If End IfEnd SubIn the previous code the column named "Devol" is GridviewCheckBoxColumn and "DaysDefDev" is a numeric column. When I check or uncheck "Devol" column an exception occurs with the message like "Can't cast from 'Telerik.WinControls.UI.RadCheckBoxEditor' to 'Telerik.WinControls.UI.GridDataCellElement'."
If I type TryCast insted of CType the object is always nothing and another exception is thrown.
Any help would be great.
Thanks.