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

GridView - Editing

1 Answer 97 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Srinivasan
Top achievements
Rank 1
Srinivasan asked on 29 Jan 2013, 11:25 AM
I have gridview also binded  with DataTable. In the end of the right side, i have a pencil image to edit  By default the gridview will not allow Editing.




If i click the pencil image then the row should allow editing (that selected row only).

How to do this?

How to enable editing for the current row?

Thanks
S.Srinivasan

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 29 Jan 2013, 02:33 PM
Hi,

Thank you for writing.

You can do that by modifying the Row.Tag in the CommandCellClick event handler and use this Tag in the CellBeginEdit event to determine whether to allow edit or not. Here is an example:
void radGridView1_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
    e.Cancel = !(e.Row.Tag == "AllowEdit");
}
 
GridViewRowInfo saveRowInfo;
void radGridView1_CommandCellClick(object sender, EventArgs e)
{
    if (saveRowInfo != null)
    {
        saveRowInfo.Tag = null;
    }
 
    GridCommandCellElement cell = (GridCommandCellElement)sender;
    cell.RowInfo.Tag = "AllowEdit";
    saveRowInfo = cell.RowInfo;
 
}

I hope this helps.
 
Regards,
Stefan
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
GridView
Asked by
Srinivasan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or