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

GridItemCollection

1 Answer 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 02 Dec 2010, 05:38 PM
I have a grid setup to allow users to select multiple rows clientside, I then want to loop through the selected items (server side) and take the data from each row and add it to another table.  How can I get to the data ?  Ive tried this, but it doesnt work

private void InsertLocations()
        {
            Telerik.Web.UI.GridItemCollection gic = this.RadGrid2.SelectedItems;
            foreach (Telerik.Web.UI.GridItem gi in gic)
            {
                string location = DataBinder.Eval(gi.DataItem, "Location").ToString();
            }
                 
        }

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Dec 2010, 10:32 PM
Hello,

I recommend that you use the following approach:
Hashtable table = new Hashtable();
foreach (GridDataItem gridDataItem in RadGrid2.SelectedItems)
{
    gridDataItem.ExtractValues(table);
    string location = table["Location"].ToString();
}

Let me know whether the suggested way is suitable for you

Regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
mww
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or