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

Cell Editing Events

3 Answers 562 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Nikk grey
Top achievements
Rank 1
Nikk grey asked on 31 Aug 2010, 12:10 PM
Hi,
I have a gridview with rows added at runtime. i have some 5 radcheckbox columns. I wish to detect changes made to checkbox columns. i.e checked state.
I am trying to use the cell_beginedit and cell_endedit events.
I am using 2010 Q1

Problems:
Begin event fires perfectly on first checkbox checked state change. After the event finishes the end event must fire. It only fires whence i change checked box state in another row. else on the same row same checked box cell it wont fire. If i change state of a checkbox cell continuosuly , the beginedit event only fires the first time, next time it doesn't fires because the editor hasn't ended. 

I tried to close the editor myself in the begin edit event but nothing happens.

void gvLiveCnns_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    // Do some work, cancel event if work not performed as expected
    this.gvLiveCnns.EndEdit();
    this.gvLiveCnns.ActiveEditor.EndEdit();
    this.gvLiveCnns.CloseEditor();
}

Any solution to this problem. Please provide a solution using this event only as i wish to cancel out editing event if worked not performed as expected.

Thank you.

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 03 Sep 2010, 11:51 AM
Hello Nikk grey,

Unlike other editors the checkbox editor is a permanent editor and it behaves differently. You should use the ValueChanged event to track when some checkbox changed its value in RadGridView. Here is a sample:

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

Please describe your scenario in more detail in order to be able to give a more precise suggestion.
 

Sincerely yours,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Nikk grey
Top achievements
Rank 1
answered on 06 Sep 2010, 07:57 AM
Hi,
Thank you for your reply. But i want some further clarification.

As i said before i have a radgridview with multiple checkbox columns. I need to detect checkstate in each cell, i.e i must know the specific cell the checked state occurred. I am attaching a picture for further clarification. 

In the picture attached i have that gridview, e.g. i wish to detect the loaded check state changed by user for each record. I must know the row and cell of the checkbox whose state is changed and the new checked state value too.

Kindly please answer with respect to this scenario. 
Thank you.


0
Jack
Telerik team
answered on 08 Sep 2010, 06:20 PM
Hi Nikk grey,

You can do this by using the CurrentCell property of RadGridView. Please consider the code snippet below:

void radGridView1_ValueChanged(object sender, EventArgs e)
{
    RadCheckBoxEditor editor = sender as RadCheckBoxEditor;
    if (editor != null)
    {
        MessageBox.Show(this.radGridView1.CurrentRow.Cells["ID"].Value.ToString() + " " + this.radGridView1.CurrentColumn.Name);
    }
}

I hope it helps.

Kind regards,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Nikk grey
Top achievements
Rank 1
Answers by
Jack
Telerik team
Nikk grey
Top achievements
Rank 1
Share this question
or