Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<asp:ImageButton ID="ibnEdit" runat="server" ImageUrl="~/Common/Images/edit-icon.png"                                   ToolTip="Click here to edit the details" 
OnClientClick="javascript:return EditCategory(('<%#DataBinder.Eval(Container.DataItem,"ID")%>');" />



I got an error 'server tag is not well formed'. Any one have an idea about this.
Posted
Updated 29-May-11 2:14am
v2

OnClientClick="javascript:return EditCategory(('<%#DataBinder.Eval(Container.DataItem,"ID")%>');" />


The double quote in front of ID is being interrupted as the ending quote of the OnClientClick property.

Try this
OnClientClick='<%# DataBinder.Eval(Container.DataItem, "ID", "javascript:return EditCategory(\"{0}\");")%> ' />
 
Share this answer
 
v2
Comments
N!dh!sh 29-May-11 13:06pm    
I tried your code. But the same error exists. Do you have any other idea.
[no name] 29-May-11 16:15pm    
Sorry, I wasn't near a compiler, and forgot to escape the quotes. Corrected
Please try this code. I think this will work. This is working in my case. Put this in the item template of the grid.


<asp:ImageButton ID="ibtnEdit" runat="server" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ID")%>'
 OnCommand="ibtnEdit_Command" 
 Style="cursor: hand;" 
OnClientClick='<%# " return EditCategory("+ DataBinder.Eval(Container.DataItem,"ID") + ");" %>' />
 
Share this answer
 
v4
Comments
sapien4u 30-May-11 3:23am    
Pelese check with this code and reply.
sapien4u 30-May-11 3:23am    
Also dont forget to mark this as ANSWER if this solve your issue.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900