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

Get values of Items from OnItemDataBound in a card view

1 Answer 77 Views
Grid
This is a migrated thread and some comments may be shown as answers.
SonicImaging
Top achievements
Rank 1
SonicImaging asked on 01 Mar 2009, 06:59 PM
Hi,  I have a RadGrid setup using the CardView Demo.  For each item/record I want to run some code and modify that item template contents based on the id field in that record during the OnItemDataBound.  I'm grabbing stuff from a related table based on this records id and changing some values in the itemtemplate.

Since its just a itemtemplate in the mastertableview how do I referance the itemtemplate when its not a column and there is no uniqueid's.  I have the single hidden column defined so I dont get the no records found issue. So im getting all of the records.

GridDataItem dataItem = e.Item as GridDataItem in my OnItemDataBound isnt null but how do I access the database records for this dataItem.  For now I just want the id field but id also like to know how to access any of the fields.

Thanks
-Keith

1 Answer, 1 is accepted

Sort by
0
SonicImaging
Top achievements
Rank 1
answered on 01 Mar 2009, 08:14 PM
Never fails,  post something then it dawns on you.  This is what Ive done.

My grid is bound to a linq database so I just took my linq table SIsite_EC_Product and equaled it to the e.Item.DataItem now theProduct contains my row that I can work with.   Pretty cool that it works this way

        if (e.Item is GridDataItem)
        {
            SIsite_EC_Product theProduct = e.Item.DataItem as SIsite_EC_Product;
        }
Tags
Grid
Asked by
SonicImaging
Top achievements
Rank 1
Answers by
SonicImaging
Top achievements
Rank 1
Share this question
or