且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在vb.net中获取GridView的imagefield值?

更新时间:2023-02-11 22:17:05

感谢您的帮助和提示.我找到了解决方法.

这是Gridview字段的aspx代码:
Thank you for help, and tips. I have found a solution.

Here is an aspx code for Gridview field:
<pre lang="xml"><asp:TemplateField><br />
            <ItemTemplate><br />
                <asp:Image ID="Image1" runat="server" ImageUrl=''<%# Eval("jan1", "~{0}.bmp") %>'' /><br />
            </ItemTemplate><br />
        </asp:TemplateField></pre><br />



而且,vb.net代码:



And, vb.net code:

<pre lang="vb">Dim img As Image = CType(GridView1.Rows(0).FindControl("image1"), Image)<br />
        TextBox1.Text = img.ImageUrl</pre><br />


/* Your Need to contact Your Image Location Folder path to Image Name retrieve from the DataBase in the f0llowing way. */

<asp:Image ID="ImageButton2" ImageUrl=''<%# String.Concat("Image/", Eval("ProductImage")) %>'' Width="50%" Height="30%" runat="server" />