6

I try to pass Eval value like this but get syntax errors:

<asp:ImageButton ID="btnOK" OnClientClick='Show("<%#Eval("Title")%>");return false;'  runat="server" ImageUrl="Images/icon.gif" />      

2 Answers 2

8

Try this instead.

<asp:ImageButton ID="btnOK" OnClientClick='<%# Eval("Title", "Show({0});return false;") %>' runat="server" ImageUrl="Images/icon.gif" />
Sign up to request clarification or add additional context in comments.

Comments

1
OnClientClick='<%#String.Format("Show('{0}');return false;",Eval("title"))%>'

or you if do it in the design view just add a databinding for the imagebutton's onClientClick property as

String.Format("Show('{0}');return false;",Eval("title"))

hope it helps you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.