New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Determine insert or edit mode in RadGrid with Batch editing


There are scenarios where it might be helpful to know whether the currently opened grid cell in Batch editing is from a new row or already existing one. Here are some samples:

  1. When you want your users to be able to insert but not to edit records, or vice versa.
  2. When you want to save user changes to database explicitly and want to determine whether they are coming from new or already existing row.
  3. When you want to prefill some values in insert mode depending on other field values.


You can achieve this requirement using the approach demonstrated below. The provided snippet uses the following event handler for a sample:

Here is the logic:

    <ClientEvents OnBatchEditOpened="batchEditOpened" />
function batchEditOpened(sender, args) {
    var item = args.get_row().control;
    if (item.get_itemIndex() < 0) { // new row
           // execute custom logic
In this article