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

Completing an edit without changing rows

4 Answers 165 Views
GridView
This is a migrated thread and some comments may be shown as answers.
johns
Top achievements
Rank 1
johns asked on 16 Aug 2007, 06:06 PM
Hi,

I have a grid bound to a list of custom objects.  The first column is a GridViewBoolean Column.  When a user clicks on the check box I would like the value immediatly reflected back into the underlying data source rather then having to change rows for it to be commited.

Is this possible?

Thanks.

4 Answers, 1 is accepted

Sort by
0
johns
Top achievements
Rank 1
answered on 16 Aug 2007, 07:26 PM
Ok, it looks like I can call SaveValue on the RadCheckBoxEditor during a cell click event.

0
johns
Top achievements
Rank 1
answered on 17 Aug 2007, 07:37 PM

Another issue.  It only works when I click on the check box itself.
If I click on the surrounding cell, the checkbox changes state, but I am not able to get to the RadCheckBoxEditor because the sending object is actually a GridCheckBoxCellElement.

Any thought?

if (alertGrid.SelectedElement is RadCheckBoxEditor)

{
   RadCheckBoxEditor rbe = (RadCheckBoxEditor)    alertGrid.SelectedElement;

rbe.SaveValue();

UpdateSelectedDeviceList();

}

else

{

GridCheckBoxCellElement gce = (GridCheckBoxCellElement)

 

}

0
Jack
Telerik team
answered on 20 Aug 2007, 09:18 AM

Hello johns,

RadCheckBoxEditor is always the first child in the children's hierarchy of GridCheckBoxCellElement. It can be reached trough the Children property. If you process the CellClick event, the cell is accessible through the sender argument of the event:

void radGridView1_CellClick(object sender, GridViewCellEventArgs e)
{
    GridCheckBoxCellElement cell = (GridCheckBoxCellElement)sender;
    RadCheckBoxEditor editor = (RadCheckBoxEditor)cell.Children[0];
}

Let us know if this helps.


All the best,

Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
johns
Top achievements
Rank 1
answered on 20 Aug 2007, 08:10 PM
Thank You,  That did the trick.
Tags
GridView
Asked by
johns
Top achievements
Rank 1
Answers by
johns
Top achievements
Rank 1
Jack
Telerik team
Share this question
or