Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A call to Bind must be assigned to a property of a control inside a template

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?

like image 610
Kolten Avatar asked Apr 22 '09 20:04

Kolten


1 Answers

  • 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") %>' />

like image 144
Steve Willcock Avatar answered Oct 03 '22 18:10

Steve Willcock