无需使用处理程序即可在Gridview中显示图像 [英] Image show in Gridview without using handler
本文介绍了无需使用处理程序即可在Gridview中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将图像上传到数据库中,并将路径存储在数据库中,图像也存储在文件夹中.
当我想在gridview中显示此图像时,它的工作正常bt,然后它的nt工作??
我的gridview页面代码在下面,请帮助我吗?
< asp:GridView ID = " runat = " AutoGenerateColumns = " 错误"
DataKeyNames = " DataSourceID = " SqlDataSource1" " HeaderText = "
InsertVisible = " ReadOnly = " 真实" SortExpression = product_Id"/>
< asp:BoundField DataField = " HeaderText = "
SortExpression = " />
< asp:TemplateField>
< ItemTemplate>
< asp:image headerText = " runat = " ID = " ImageUrl = ' <%#(〜/Image/")%>' AlternateText = ' <%#Bind("Fname")%>'/>
</ ItemTemplate >
</ asp:TemplateField >
< asp:BoundField DataField = " HeaderText = "
SortExpression = " />
< asp:BoundField DataField = " HeaderText = "
SortExpression = " />
</ 列 >
</ asp:GridView >
< asp:SqlDataSource ID = " runat = "
ConnectionString = "
SelectCommand = " > </ asp:SqlDataSource >
如何在不使用handler的情况下显示图像.
SelectCommand = " > </ asp:SqlDataSource >
我如何不使用处理程序即可显示图像.Plzz帮助我..Thnxx .. !!
像这样尝试
图像绑定网格视图 [ ^ ]
示例:
< asp:Image 运行 =" ImageUrl =' <%#" + DataBinder.Eval(Container.DataItem, Fname") %>' / >
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??
<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..!!
解决方案
ConnectionStrings:crackers1ConnectionString3 %>" SelectCommand="SELECT * FROM [Productmaster]"></asp:SqlDataSource>
How can i show image without using handler.Plzz help me..Thnxx..!!
try like this
Image bind gridview [^]
Sample:
<asp:Image runat="server" ImageUrl='<%# "~/Image/" + DataBinder.Eval(Container.DataItem,"Fname") %>' />
这篇关于无需使用处理程序即可在Gridview中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文