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

Radgrid ItemCommand event has no controls

1 Answer 106 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
Morten Hoegh
Top achievements
Rank 1
Morten Hoegh asked on 26 Apr 2010, 01:40 PM
Hi,

Im trying to make a radgrid work with edit mode in a webpart for MOSS 2007.
All the events fire as they should BUT I cant get the edited values in the event.

The controls property on the edit cells has a count = 0.
It works fine when I use the control in a normal aspx page.

The code is:

 

protected void radGrid_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

switch (e.CommandName)

 

{

 

 

case

 

"Update":

 

{

 

GridEditFormItem gridInsert = (GridEditFormItem)e.Item;

 

 

string pNavn = ((TextBox)(gridInsert["Navn"].Controls[0])).Text;

 

...


The .Controls[0] throw an "index out of range" because the cell holds no controls. The gridInsert["Navn"] does exist.

Please help.

 

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 26 Apr 2010, 03:04 PM
Hello Morten,

The more unified approach would be to case the e.Item argument to GridEditableItem (instead of GridEditFormItem) as it will work both for inplace and edit forms editing, i.e.:

GridEditableItem gridInsert = (GridEditableItem)e.Item;

Additionally, how to extract the data from the corresponding column editors you can see from the resources below:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editmodes/defaultcs.aspx (using column editors)
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/extractvalues/defaultcs.aspx (using server API for extraction)

http://www.telerik.com/help/aspnet-ajax/grdaccessingcellsandrows.html (Help article)

Best regards,
Sebastian
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Sharepoint Integration
Asked by
Morten Hoegh
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or