javascriptc#asp.netservertag

The server tag is not well formed for imageButton


<asp:ImageButton ID="Image1" Width="50px" Height="50px" runat="server" ImageUrl='<%# "ImageHandler.ashx?ImID="+ Eval("Ifile")  %>' OnClientClick='<%#"javascript:window.open(' ImageHandler.ashx?ImID="+ Eval("Ifile")  "')"%>' />

Does anyone tell me what's wrong with this tag? I'm getting error on this tag.


Solution

  • You cannot use an apostrophe ' inside the binding, use &#39;.

    <asp:ImageButton ID="Image1" Width="50px" Height="50px" runat="server" ImageUrl='<%# "ImageHandler.ashx?ImID="+ Eval("Ifile") %>' OnClientClick='<%#"javascript:window.open(&#39;ImageHandler.ashx?ImID="+ Eval("Ifile") + "&#39;)" %>' />