0

I'm going to ask an easy one here for those who are very familiar with this kind of syntax. Unfortunately I'm not, and I'm having a hard time with using single quotes and double quotes for raising a javascript method in an OnClick event. Here is my code:

<script type="text/javascript">
    function OpenWindow(workItemId) { ... }
</script>

EDIT: copy-paste mistake, forgot the server block quotes <%# %>

<asp:Image ID="imgDescription" ImageUrl="../Images/Tooltip_t.gif" runat="server" OnClick='OpenWindow('<%# Eval("WorkItemId") %>' );' />

3 Answers 3

2

This should work:

onclick='<%# "OpenWindow(" + Eval("WorkItemId") + ");" %>'
Sign up to request clarification or add additional context in comments.

Comments

0

maybe like this ?

<asp:Image ID="imgDescription" ImageUrl="../Images/Tooltip_t.gif" runat="server" OnClick="OpenWindow(Eval(\"WorkItemId\"));" />

Comments

0

May be you should use screening slashes with your quotes like: \"

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.