Hello... im trying to create an image column in a datagrid but it isnt working(both the boundcolumn and the hyperlink column are working fine). Below im posting both the asp.net code from my datagrid and the vb code from database connection. Can anyone tell me why it isnt working????
Datagrid code
---------------------------------------------------------------------------------------------------------------------------
<asp:dataGrid id="dgrid" runat="server" Font-Size="X-Small" AllowSorting="True" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Thumbnail">
<ItemTemplate>
<asp:Image ImageUrl=/revelaqui/fotos/<%#Container.DataItem("albuns.utilizador")%>/thumbs/thumb<%#Container.DataItem("fotos.urlfoto")%> Runat="server">
</asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
<asp:HyperLinkColumn DataNavigateUrlField="urlLink" DataTextField="titulo" HeaderText="Titulo"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="dataUpload" HeaderText="Data de upload"></asp:BoundColumn>
</Columns>
</asp:dataGrid>
---------------------------------------------------------------------------------------------------------------------------
database connection code
---------------------------------------------------------------------------------------------------------------------------
Dim dbconn, dbcomm, sql
Dim username As String = CStr(Session("utilizador"))
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("bd/fotodados.mdb"))
sql = "SELECT fotos.urlfoto, fotos.titulo, fotos.dataUpload, fotos.urlLink, albuns.utilizador FROM fotos INNER JOIN albuns ON albuns.IdAlbum=fotos.idAlbum WHERE (albuns.titulo=As minhas fotografias AND albuns.utilizador=" & username & ")"
dbcomm = New OleDbCommand(sql, dbconn)
dbconn.Open()
dgrid.DataSource = dbcomm.ExecuteReader()
dgrid.DataBind()
dbconn.Close()
---------------------------------------------------------------------------------------------------------------------------
Datagrid code
---------------------------------------------------------------------------------------------------------------------------
<asp:dataGrid id="dgrid" runat="server" Font-Size="X-Small" AllowSorting="True" AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn HeaderText="Thumbnail">
<ItemTemplate>
<asp:Image ImageUrl=/revelaqui/fotos/<%#Container.DataItem("albuns.utilizador")%>/thumbs/thumb<%#Container.DataItem("fotos.urlfoto")%> Runat="server">
</asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
<asp:HyperLinkColumn DataNavigateUrlField="urlLink" DataTextField="titulo" HeaderText="Titulo"></asp:HyperLinkColumn>
<asp:BoundColumn DataField="dataUpload" HeaderText="Data de upload"></asp:BoundColumn>
</Columns>
</asp:dataGrid>
---------------------------------------------------------------------------------------------------------------------------
database connection code
---------------------------------------------------------------------------------------------------------------------------
Dim dbconn, dbcomm, sql
Dim username As String = CStr(Session("utilizador"))
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("bd/fotodados.mdb"))
sql = "SELECT fotos.urlfoto, fotos.titulo, fotos.dataUpload, fotos.urlLink, albuns.utilizador FROM fotos INNER JOIN albuns ON albuns.IdAlbum=fotos.idAlbum WHERE (albuns.titulo=As minhas fotografias AND albuns.utilizador=" & username & ")"
dbcomm = New OleDbCommand(sql, dbconn)
dbconn.Open()
dgrid.DataSource = dbcomm.ExecuteReader()
dgrid.DataBind()
dbconn.Close()
---------------------------------------------------------------------------------------------------------------------------