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

ItemCommand, DeleteCommand DataItem

3 Answers 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 02 May 2008, 01:06 AM

Dear Telerik,

I have bound my datasource to the radgrid and can see that for some ItemDataBound events the e.Item.DataItem is setup with the object from the DataSource. Great ! However, when I need the DataItem, in either the ItemCommand or the DeleteCommand events (when I can tell the user has pressed the Delete button) the DataItem == null. I have seen the example on how to get some DataKeyValues but I wonder why, given the Databound object is obviously available in the ItemDataBound, it cant be setup for the DeleteCommand and ItemCommand aswell. Maybe you could put this on my wishlist ?

Thanks,

Simon

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 02 May 2008, 08:00 AM
Hi Simon,

It depends on which command is firing the event - whether it would be a dataItem/EditForm item. Additionally, since the data is already available after ItemDataBound, it can be extracted from the items which are raising the event(s). Nevertheless, we will consider your suggestion as a possible feature request.

All the best,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Chris
Top achievements
Rank 1
answered on 26 Sep 2008, 02:16 PM
Yes Simon, you made a good concern.  I think it would be nice to have the dataitem value available on those event.

Chris
0
Vlad
Telerik team
answered on 26 Sep 2008, 02:28 PM
Hello guys,

DataItem cannot be available in ItemCommand due to very simple fact. We cannot store DataItem in ViewState. This is exactly in the same way as in MS DataGrid and MS GridView.

Greetings,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Simon
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Chris
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or