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

GridDataBoundGrid Image??

hej, I am trying to add a Image to my GridDataBoundGrid... I am useing this code : void GridQueryCellInfo(object sender, GridQueryCellInfoEventArgs e) { e.Style.CellType = "PictureBox"; e.Style.CellValue = GetImage("filename.gif"); e.Style.CellValueType = typeof(Image); } I tryed "PictureBox", "ImageCell", "Image", non of em worked... GetImage() returns a Image obj. Can any help me ??? thx!

4 Replies

DE Deus August 12, 2005 05:38 AM

I forgot to tell that, the row has this text = "System.Drawing.Image"... :o)


AD Administrator Syncfusion Team August 12, 2005 06:32 AM

Just try these two properties (don''t set the CellValueType) using "Image" as the celltype. e.Style.CellType = "Image"; e.Style.CellValue = GetImage("filename.gif"); And things will work much better (faster) if you cache GetImage("filename.gif"); in a form variable and just use that variable in QueryCellInfo.


DE Deus August 12, 2005 06:43 AM

Dident help :s When I fill the Grid I use a DataTable: DataTable dt = new DataTable("Table"); dt.Columns.Add("Image", Type.GetType("System.Int32")); And I set it to 0...


AD Administrator Syncfusion Team August 12, 2005 07:30 AM

If you have a column in your database where you want to see an Int32 value used in the cell, and you also want to see an image in teh cell, then you have to: 1) Add the images you want to use to an ImageList object. 2) Set teh CellType on the column to "Static" or leave it unset so it defaults to "TextBox". 3) In QueryCellInfo for cells in this column, set e.Style.ImageList = yourImageListObject; e.Style.ImageIndex = someIntValueThatIsTheIndexOfTheImageInYourImageList; Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GDBG_Images_79f698b0.zip

Loader.
Live Chat Icon For mobile
Up arrow icon