We had a javascript function that was using server side property like the following,
<a href="#" onclick="MyFunction('<%=SomeProperty %>')">Link</a>
When "SomeProperty" contains single quote "'" this was causing script errors in the page.
To solve this error, just add the following after SomeProperty
.ToString().Replace("'","\\'").Replace("\"",""")
so that it will look like this at the end
<a href="#" onclick="MyFunction('<%=SomeProperty.ToString().Replace("'","\\'").Replace("\"",""") %>')">Link</a>
This will solve the problem
Note: when i tried to do this from the code behind, replacing the quote, it didn't working
<a href="#" onclick="MyFunction('<%=SomeProperty %>')">Link</a>
When "SomeProperty" contains single quote "'" this was causing script errors in the page.
To solve this error, just add the following after SomeProperty
.ToString().Replace("'","\\'").Replace("\"",""")
so that it will look like this at the end
<a href="#" onclick="MyFunction('<%=SomeProperty.ToString().Replace("'","\\'").Replace("\"",""") %>')">Link</a>
This will solve the problem
Note: when i tried to do this from the code behind, replacing the quote, it didn't working