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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Header Image

Thread ID:

Created:

Updated:

Platform:

Replies:

21241 Nov 4,2004 08:52 PM UTC Nov 8,2004 12:30 AM UTC WinForms 7
loading
Tags: GridControl
Bernard Herrok
Asked On November 4, 2004 08:52 PM UTC

I have hidden the header row in the databoundgrid control and made a the next row down a header row. how do i insert an image on the new column i''ve created?

Administrator [Syncfusion]
Replied On November 4, 2004 11:27 PM UTC

Do you mean the new row that you added (as opposed to the new column)? If it is the row, then you can handle the PrepareViewStyleInfo event. In the handler, if e.COlindex and e.RowIndex point to the cell where you want the image, you can set e.Style.ImageList, e.Style.ImageIndex to specify the image you want to see. Additionally, you will have to set e.Style.CellType = "Static" so the image drawing code will be hit. (The default drawing for teh header celltype does not draw images.) There may be other properties you''ll want to set as well. There are other ways to do this if this will not serve your needs.

Bernard Herrok
Replied On November 5, 2004 01:28 AM UTC

it''s just a standard row, made in into a column. .Model.Rows.HeaderCount = 1 >Do you mean the new row that you added (as opposed to the new column)? > >If it is the row, then you can handle the PrepareViewStyleInfo event. In the handler, if e.COlindex and e.RowIndex point to the cell where you want the image, you can set e.Style.ImageList, e.Style.ImageIndex to specify the image you want to see. Additionally, you will have to set e.Style.CellType = "Static" so the image drawing code will be hit. (The default drawing for teh header celltype does not draw images.) There may be other properties you''ll want to set as well. > >There are other ways to do this if this will not serve your needs.

Administrator [Syncfusion]
Replied On November 5, 2004 06:49 AM UTC

I think the technique described above should work in this case. Here is a minimal sample. WindowsApplication9_235.zip

Bernard Herrok
Replied On November 7, 2004 08:17 PM UTC

Ok, i got that to work. But how i change images at runtime? i have CellDoubleClick event, that changes the imageindex but it doesn''t update view. I thought that preparestyleview method was called every time the the grid refreshed. >I think the technique described above should work in this case. Here is a minimal sample. > > >WindowsApplication9_235.zip > >

Bernard Herrok
Replied On November 7, 2004 09:06 PM UTC

Also, can i align the image to top on merged cells. i have dynamically merged cells and when image''s attached, it aligns in the center. thanks

Administrator [Syncfusion]
Replied On November 7, 2004 10:59 PM UTC

What code are you using in your DounleClick handler? If you are trying to set grid[row, col].ImageIndex = ???, this will not work. In a GridDataBoundGrid, you cannot set cell specific properties (other than CellValue). Instead, you have to dynamically set the ImageIndex in PrepareViewStyleInfo. If you can post a sample project showing what you are trying to do, maybe I can suggest something.

Bernard Herrok
Replied On November 8, 2004 12:30 AM UTC

your right, i can''t set the property outside the prepareviow. but if you use datagrid.refresh, it works. thanks!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;