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

Javascript : Check if RadGrid item is in Edit mode

1 Answer 363 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahmoud
Top achievements
Rank 1
Mahmoud asked on 12 Jan 2012, 06:28 AM

Iam using a telerik RadGrid and I want to check if GridDataItem is in edit mode or not

Using javascript .

I can handle this using VB but I want to do it on Client Side.

If anyone can tell me also how to loop through all Items in the Grid and get selected item

using JavaScript.

I'm stuck Here .. Any Help Please ... I will be grateful.

2) I have a problem with OnCommand function in Javascript

I have a commandItemTemplate in radgrid.

and I add a client event: <ClientEvents OnCommand="OnCommand" />

Function: function OnCommand(sender, args) { if (args.get_commandName() == 'EditSelected') { ....}

The OnCommand doesn't fire on any of the commands in the CommandItemTemplate , on the other hand , it fires on other commands like (Edit,Update,Delete,...).

I don't know why?? I need Help Please.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 13 Jan 2012, 06:59 AM
Hello Mahmoud,

Try the following javascript to get the selected items.
JS:
function select()
{
  var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
  var row = masterTable.get_dataItems();
  for (var i = 0; i < row.length; i++)
  {
    alert(masterTable.get_selectedItems().length);
  }
}

The OnCommand event will be raised for each grid command which is about to be triggered (sorting, paging, filtering, editing, etc.). Check the following help documentation which expalins more about this.
OnCommand.

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