I want to show a thumbnail image inside a gridview instead of the text. This is what I am trying:
<asp:TemplateField HeaderText="Image" SortExpression="Image">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Image") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Image ID="thumbnail" runat="server" ImageUrl="<%# Bind("Image") %>" />
</ItemTemplate>
</asp:TemplateField>
What is the syntax i should be using?
Try using Eval instead of Bind for the ImageUrl - this is one way binding.
If you are still having problems, using single quotes instead of double quotes around the property might help: <asp:Image ID="thumbnail" runat="server" ImageUrl='<%# Eval("Image") %>' />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With