Adding Images to the first column of DataBoundGrid

I''m using a DataBoundGrid linked to a dataset that has 3 queries on a Hierarchy way... I want to add Icons (windows explorer style) to the first column, is it possible? by using the techniques described on some parts of the forum I get the image to appear on the left hand side of the cell but I need it on the left hand side of the text, the gryd seems to be leaving enough space for the image, but drwaing it in the wrong place. My code is (on the PrepareViewStyleInfo event): if(e.RowIndex == 0 ) { e.Style.CellType = "Static"; e.Style.CellAppearance = GridCellAppearance.Raised; if(e.ColIndex == 1) { e.Style.ImageList = imageTree; e.Style.ImageIndex = 0; } }

2 Replies

ES Eduardo Silva August 19, 2005 04:52 PM UTC

I''ve discovered (well this is only a theory) that because my cells are of type DataBoundTreeCell, the ImageList and ImageIndex properites are not valid... any ideas? I''ve tried removing the code before and adding this instead: GridHierarchyLevel level0 = this.dbgTree.Binder.RootHierarchyLevel; level0.InternalColumns[0].StyleInfo.ImageList = imageMenu; level0.InternalColumns[0].StyleInfo.ImageIndex = 0; still no luck


AD Administrator Syncfusion Team August 19, 2005 05:07 PM UTC

If you want them to be seen in addition to the +/- and treelines, then you will likely have to derive your own celltype to manage this. If you have the source code, you can take our code in \Src\Extensions\DataBound\GridDataBoundTreeCell.cs, and tweak it to draw the extra bitmap.

Loader.
Up arrow icon