How can I get the image url from database.

Jun 21 2010 5:35 AM

hi,
I am new to .NEt, I am doing a classifieds website and tried to save the image in server,in a seperate folder and stored that address in MS access databse.when I wanted to display that image in a gridview,its not showing the image.It would be great if some one suggests the solution for it.
 
In the seperate column when Ia m trying to see the image location using bound field,its displaying C:\websites\Azango\user_images\rj.jpg, but where as its not showing the image in the item template field.please help me in displaying the image.
Thanks in advance.
 
<
asp:GridView ID="GridView2" PageSize="10" style="text-align:left;" EmptyDataText="No results found." runat="server" DataSourceID="AccessDataSource2"
AllowPaging="True" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" GridLines="None" Width="758px" >
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField HeaderText="Reserve">
<ItemTemplate>




<asp:ImageButton ID="ImageButton1" runat="server" style="border:none; width:100px; height:50px;" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "photos") %>' />

</ItemTemplate>

</asp:TemplateField>


<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="price" HeaderText="price" SortExpression="price" />
<asp:BoundField DataField="photos" HeaderText="photos" SortExpression="photos" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />

</asp:GridView>

<asp:AccessDataSource ID="AccessDataSource2" runat="server"
DataFile="~/access_db/classifieds.mdb"
SelectCommand="SELECT [Title], [price], [photos] FROM [post_tbl] WHERE (([city] = ?) AND ([catg] = ?) AND ([subcat] = ?)) ORDER BY [time]">
<SelectParameters>
<asp:SessionParameter Name="city" SessionField="city" Type="String" />
<asp:QueryStringParameter Name="catg" QueryStringField="mcatg" Type="String" />
<asp:QueryStringParameter Name="subcat" QueryStringField="msubcatg"
Type="String" />
</SelectParameters>
</asp:AccessDataSource>

Answers (1)