I have the following HTML code from an ImageButton.
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:DataList ID="dlImagenes" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" HorizontalAlign="Center" PagedControlID="dlImagenes">
<ItemTemplate>
<asp:ImageButton ID="imgValidarImagenes" runat="server" Width="200px" Height="150px" ImageUrl='<%# Bind("imagen") %>' OnClick='<%# "popImage('" + Bind("imagen") + "', Validar imagen)"%>' CommandArgument='<%# Container.ItemIndex %>' />
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="dlImagenes"/>
</Triggers>
</asp:UpdatePanel>
And I have the following error:
ASP.NET error at runtime: A call to Bind must be assigned to a property of a control within a template.
I think it's because the quotes on the property of the popImage function of the onClick event are misplaced.
I tried several ways but I still can not find the correct way to write it.
The following are the codes that did not work for me:
OnClick='popImage('<%# Bind(\"imagen\") %>', Validar imagen)'
OnClick='popImage('<%# Bind("imagen") %>', Validar imagen)'
Could it be that you are tackling the problem badly?