0

What is the correct syntax of this snippet:

<asp:Button OnClick="foo" runat="server"  ID="foo"
 OnClientClick="return confirm("'<%= GetLocalResourceObject("fooRessource") %>'");"  /> 

i'm stuck with the ' and " at OnClientClick

1
  • you will have to use databinding. Commented Apr 10, 2015 at 12:33

2 Answers 2

3

could you not do this?

<asp:Button OnClick="foo" runat="server"  ID="foo"
OnClientClick="return myconfirm()");"  /> 

<script>
function myconfirm() 
{ 
   return confirm("<%= GetLocalResourceObject("fooRessource") %>");
}
</script>  
Sign up to request clarification or add additional context in comments.

2 Comments

@fubo, don't use the function name confirm as that will get confusing with window.confirm... you'd end up with recursion
yep - correct coder here: function myconfirm() { return confirm("<%= GetLocalResourceObject("fooRessource") %>"); }
1

Can you do this in our code behind file?

foo.OnClientClick = "return confirm('" + GetLocalResourceObject("fooRessource") + "')";

I'm unsure how well this will work inline.

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.