We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

icon into GridHeader

i would like to put an icon into gridHeader but by writting a code

7 Replies

AD Administrator Syncfusion Team January 27, 2005 10:21 AM UTC

For a GridControl, try adding these lines to the Form_Load event to show an icon in col header 3. ImageList imageList = new ImageList(); imageList.Images.Add(SystemIcons.Warning.ToBitmap()); imageList.Images.Add(SystemIcons.Application.ToBitmap()); this.gridControl1[3,0].ImageList = imageList; this.gridControl1[3,0].CellType = "Static"; this.gridControl1[3,0].ImageIndex = 0; If you want the cell to keep the 3d appearance, also set the style.CellAppearance property. If you are using a GridDataBoundGrid, then you would need to handle PrepareViewStyleInfo to set the same properties on e.Style based on the values of e.ColIndex and e.RowIndex.


HV Hrvoje Voda January 27, 2005 11:04 AM UTC

I''m trying to put icon in CellHeader 2 but i can only put in CellHeader 0! Why?


AD Administrator Syncfusion Team January 27, 2005 11:22 AM UTC

Are you using a GridDataBoundGrid? If so, you cannot use the code snippets above. You have to use PrepareViewStyleInfo.


HV Hrvoje Voda January 27, 2005 12:07 PM UTC

I''m using BoundControl but I don''t know how to use ColIndex? e.ColIndex ?


AD Administrator Syncfusion Team January 27, 2005 12:21 PM UTC

Here is a link to a sample. http://www.syncfusion.com/forums/Uploads/GDBG_ImageInColHeader.zip


HV Hrvoje Voda January 27, 2005 12:51 PM UTC

Great! Now it all works! I just have one more question and then i want ask it ever again! :) How do i put that icon in center of a CellHeader? There is now method for it within Cell properties


AD Administrator Syncfusion Team January 27, 2005 12:58 PM UTC

Instead of setting CellType = "Static", try this code. e.Style.CellType = "Image"; e.Style.ImageSizeMode = GridImageSizeMode.CenterImage;

Loader.
Live Chat Icon For mobile
Up arrow icon