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

Cancel edit in GridCreateColumnEditorEvent

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
HK
Top achievements
Rank 1
HK asked on 04 Nov 2010, 09:17 AM
Hi,

Is there a way to cancel the edit command in gridCreateColumnEditorEvent? I have tried the following, but it is not working:

protected void grid_CreateColumnEditor(object sender,Telerik.Web.UI.GridCreateColumnEditorEventArgs e)
{
  
  if (//Some condition)
  {
    grid.MasterTableView.ClearEditItems();
  }
}


//HÃ¥kan

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 04 Nov 2010, 12:24 PM
Hello,


A better option is cancelling the EditCommand in ItemCommand event of the grid based on the condition. Please check the code below and see whether it suits your need.

code:
protected void RadGrid3_ItemCommand(object source, GridCommandEventArgs e)
{
    if (e.CommandName == RadGrid.EditCommandName)
    {
        e.Canceled = true; // Check for the condition and cancel the event
    }
}



-Shinu.
Tags
Grid
Asked by
HK
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or