Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii I m uploading image in database and storing the path in database and image also in folder.
Its working Fine bt when i want to show this image in gridview then its nt working??
My gridview page code is below please help me??

C#
<asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="product_Id" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:BoundField DataField="product_Id" HeaderText="product_Id" 
                    InsertVisible="False" ReadOnly="True" SortExpression="product_Id" />
                <asp:BoundField DataField="product_Name" HeaderText="product_Name" 
                    SortExpression="product_Name" />
                           <asp:TemplateField>
                   <ItemTemplate>
                       <asp:image  headerText="Prod_Image" runat ="server"  ID ="img4" ImageUrl= '<%#("~/Image/") %>' AlternateText='<%# Bind("Fname") %>' />
                   </ItemTemplate>
               </asp:TemplateField>


                <asp:BoundField DataField="product_Qty" HeaderText="product_Qty" 
                    SortExpression="product_Qty" />
                <asp:BoundField DataField="product_Rate" HeaderText="product_Rate" 
                    SortExpression="product_Rate" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:crackers1ConnectionString3 %>" 
            SelectCommand="SELECT * FROM [Productmaster]"></asp:SqlDataSource>


How can i show image without using handler.Plzz help me..Thnxx..!!
Posted

1 solution

try like this

Image bind gridview [^]

Sample:

ASP.NET
<asp:Image runat="server" ImageUrl='<%# "~/Image/" + DataBinder.Eval(Container.DataItem,"Fname") %>' />
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900