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

Radgrid Polymorphism, Griditem, GridDataItem

1 Answer 208 Views
Grid
This is a migrated thread and some comments may be shown as answers.
G H
Top achievements
Rank 1
G H asked on 20 Apr 2010, 10:26 PM
I've been using event handlers to do some custom formatting, or calculations within grids for a while. I will usually write something like so, that accesses the TableCells by UniqueName:

void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            GridDataItem item = e.Item as GridDataItem;
            if (item != null)
            {
                Do some work
                ....
                        item["ColName"].text = ...;
                .....
               
            }
           GridFooterItem item = e.Item as GridFooterItem;
            if (item != null)
            {
                Do the same work
                ....
                        item["ColName"].text = ...;
                .....
               
            }
        }
To prevent code duplication, is there anyway i can use a base class or interface member to reference the TableCells by name?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 22 Apr 2010, 07:30 AM
Hello G H,

I am afraid that the RadGrid items' base class (GridItem) does not support indexing, so you will have to cast e.Item before referencing a cell by column UniqueName.

Regards,
Dimo
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
Grid
Asked by
G H
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or