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 10:38 AM UTC

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

AD Administrator Syncfusion Team August 12, 2005 11:32 AM UTC

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 11:43 AM UTC

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 12:30 PM UTC

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

Live Chat Icon For mobile
Up arrow icon