cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying image in gridview.

Former Member
0 Kudos

Hi guys, i am trying to display a picture in a gird view on clicking the view button. no error was displayed, image was not displayed either. Help please!

Code Behind

Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged

Dim picture As ArrayList = New ArrayList()

picture = Session("Picture")

CType(GridView1.Rows(GridView1.SelectedIndex).FindControl("pictures"), Image).Visible = True

CType(GridView1.Rows(GridView1.SelectedIndex).FindControl("pictures"), Image).ImageUrl = picture(GridView1.SelectedIndex)

CType(GridView1.Rows(GridView1.SelectedIndex).FindControl("View"), Button).Text = picture(GridView1.SelectedIndex)

End Sub

web service code

convert = oRecSet.Fields.Item("PicturName").Value

newHeaderRow("Picture") = "C:/Program Files/SAP/SAP Business One/Bitmaps/" + convert

Thank You,

Kean

Edited by: kean tan on Jun 26, 2008 9:47 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Try this..... Set matrix column to it_PICTURE

Dim oMatrix As SAPbouiCOM.IMatrix

Dim oColumn As SAPbouiCOM.IColumn

Dim oPic As SAPbouiCOM.IPictureBox

oColumn = oMatrix.Columns.Add("picColumn", SAPbouiCOM.BoFormItemTypes.it_PICTURE)

oPic = oColumn.Cells.Item(1).Specific ' <----


the first cell of this column

oPic.Picture = "d:\mypic1.bmp"

oPic = oColumn.Cells.Item(2).Specific ' <----


the second cell of this column

oPic.Picture = "d:\mypic2.bmp"

Regards,

Puneeth S

Former Member
0 Kudos

Thank for the reply, but is there any mistake with my current coding? i would like to use back the posted coding.

Regard,

Kean

Former Member
0 Kudos

Kean,

Some more information would be helpful.

Are you doing this as an independent application (perhaps web based) that connects through the SBO Web service?

Or is this a integration through the SBO UI?

From the looks of it, it will probably be the first one. In that case you may have to look in other areas, such as the MSDN (Microsoft Developers Network) for more relevant information.

Refer to [MSDN Display Images In A GridView|msdn.microsoft.com/en-us/library/aa479350.aspx]

If it is a UI integration, then Puneeth's code is pretty useful.

Former Member
0 Kudos

Hi Daniel Blackwell,

Yes i am developing a web page which link to web service. I tried but still it did not work. No error message. No image displayed. Sigh.

Regard,

Kean

Former Member
0 Kudos

You can try posting your question on the [Visual Basic Forums|http://www.vbforums.com] or a similar site.

You will probably get a good response from there as your problem is not with SAP but the Gridview or web service itself.

Sorry I couldn't solve your question, but I'm sure there is someone who can.

Regards,

Daniel

Former Member
0 Kudos

Thank Daniel!

Edited by: kean tan on Jul 11, 2008 3:38 PM

Answers (2)

Answers (2)

Former Member
0 Kudos

I've ever tried to display image as you want. Then, i found an article talking about how to view image by adding custom buttons, both to a template and to the fields of a GridView or DetailsView control. Guess it may help you.

http://www.asp.net/web-forms/overview/data-access/custom-button-actions/adding-and-responding-to-but...

Former Member
0 Kudos

I am quite attracted by the title of this question. I am new to the C# UI GridView. This is the same question I want to ask. The discussions here are also helpful to my GridView image displaying problem.