fubo
fubo

Reputation: 45947

Syntax issue with JavaScript / ASPX

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

Upvotes: 0

Views: 284

Answers (2)

Mark Quinn
Mark Quinn

Reputation: 46

could you not do this?

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

<script>
function myconfirm() 
{ 
   return confirm("<%= GetLocalResourceObject("fooRessource") %>");
}
</script>  

Upvotes: 3

Kallum Tanton
Kallum Tanton

Reputation: 777

Can you do this in our code behind file?

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

I'm unsure how well this will work inline.

Upvotes: 1

Related Questions