I have a gridview and want to add an Image field in it.
I also need to test to see if the image is in the folder or ftp site if it is then output link to the image else output just the name of the file
this is what I tried but is probably really wrong
Dim dt As Data.DataTable = New Data.DataTable
dt.Columns.Add("Position")
dt.Columns.Add("LineCode")
dt.Columns.Add("PartNo")
dt.Columns.Add("Description")
dt.Columns.Add("Qty")
dt.Columns.Add("Images")
For Each Row In Ds.Tables(0).Rows
astring1 = Row.Item(4).ToString
' Get all Product File part numbers that match the E-Cat number
Dim DsParts As New Data.DataSet
Dim Sqlstr3 As String = "SELECT Distinct Product.PartNo, Product.LineCode, Product.EcatNo FROM Product WHERE (Product.ECatNo = ?) "
Dim da1 As New Data.OleDb.OleDbDataAdapter(Sqlstr3, conn)
da1.SelectCommand.Parameters.Add("?", Data.OleDb.OleDbType.VarChar).Value = Row.Item(4).ToString
'Filling the DataSet
If Ds.Tables(0).Rows.Count > 0 Then
da1.Fill(DsParts)
End If
If DsParts.Tables(0).Rows.Count = 0 Then
ListBox1.Items.Add(New ListItem("No Records Found"))
End If
For Each MyRow In DsParts.Tables(0).Rows
astring = MyRow.Item(0).ToString
'Set up Part String so that #, Description, Position & Quantity always line up
'
Dim dr As Data.DataRow = dt.NewRow
dr("Position") = Row.Item("position")
dr("LineCode") = MyRow.Item("LineCode")
dr("PartNo") = astring
dr("Description") = Row.Item("partterminologyname")
dr("Qty") = Row.Item("Qty")
If System.IO.File.Exists(Server.MapPath("~/images1/" & MyRow.Item("ECatNo") & ".jpg")) Then
dr("Images") = "~/images1/" & MyRow.Item("ECatNo") & ".jpg"
Else
dr("Images") = astring
End If
dt.Rows.Add(dr)
Next
Next
GridView1.DataSource = dt
GridView1.DataBind() Any help would be great