phight Posted May 28, 2005 Posted May 28, 2005 Hello... i'm trying to create an image column in a datagrid but it isn't working(both the boundcolumn and the hyperlink column are working fine). Below i'm posting both the asp.net code from my datagrid and the vb code from database connection. Can anyone tell me why it isn't 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() --------------------------------------------------------------------------------------------------------------------------- Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.