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

ItemIndex is zero when grid has a client oncommand function

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rei
Top achievements
Rank 1
rei asked on 23 Sep 2010, 04:17 AM
Hi,

I am using the Radgrid's client-Events -> Oncommand  handler to add some validations  to a button before it is submitted, it works fine and was able to cancel the event when a criteria is not met, but for some buttons like the "Delete" button where I didnt add any validations,  the itemindex that is passed on my server side  OnItemCommand  event handler is always zero. Is this supposed to be the case? How do I pass the itemindex argument?  I tried to do a firecommand (args.get_commandName(), args.get_commandargment()) but it returns an out of memory exception. Please see below code that I have for the raisecommand


function raisecommand(sender,args){
if (args.get_commandName=="ViewDetails"){
<<some validations here>>
args.set_cancel(true);
        }

}


Thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Sep 2010, 11:18 AM
Hello Rei,

I am getting the ItemIndex like below . Is this is the same way that you tried?

C#:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
  {
      if (e.CommandName == RadGrid.DeleteCommandName)
        int index=  e.Item.ItemIndex;
  }

Thanks,
Princy.

Tags
Grid
Asked by
rei
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or