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

How to the [RadCheckBoxEditor] ?

3 Answers 213 Views
GridView
This is a migrated thread and some comments may be shown as answers.
sangki
Top achievements
Rank 1
sangki asked on 14 Jul 2009, 08:56 AM

private void managerGrid_ValueChanged(object sender, EventArgs e)
        {
            if (sender is GridCheckBoxCellElement)
            {
                GridCheckBoxCellElement cell = (GridCheckBoxCellElement)sender;
                RadCheckBoxEditor checkbox = cell.Children[0] as RadCheckBoxEditor;  <- Error

How???

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 15 Jul 2009, 02:55 PM
Hi sangki,

In our latest release, the sender of the ValueChanged event is the editor itself. So, in this case you don't need the cell element. Here is the modified code:

void radGridView1_ValueChanged(object sender, EventArgs e) 
    if (sender is RadCheckBoxEditor) 
    { 
        RadCheckBoxEditor editor = (RadCheckBoxEditor)sender; 
        //... 
    } 

I hope this helps. Should you have any further questions, please write me back.

All the best,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Peter Luth
Top achievements
Rank 1
answered on 25 Aug 2009, 06:10 AM
Hello,

I am surprised that this changed suddenly with no breaking notice in the release notes.

In our code we are expecting sender to be a GridDataCellElement, which got recommend on these forums:

GridDataCellElement cell = sender as GridDataCellElement; 
if (cell != null
    OurCustomObject obj = cell.RowInfo.DataBoundItem as OurCustomObject; 

How can we access the row info or databound item with the RadCheckBoxEditor?
0
Julian Benkov
Telerik team
answered on 27 Aug 2009, 03:15 PM
Hello Peter Luth,

Actually, we did mention these changes in the Q2 2009 release notes - they are in red color.

To access a row or a DataBoundItem you can use the following code snippet:

GridDataCellElement cellElement = editor.EditorElement.Parent as GridDataCellElement; 
if (cellElement != null
    object obj = cellElement.RowInfo.DataBoundItem; 

Let us know if you need additional assistance.


Best wishes,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
sangki
Top achievements
Rank 1
Answers by
Jack
Telerik team
Peter Luth
Top achievements
Rank 1
Julian Benkov
Telerik team
Share this question
or