I was wondering if there are any c# libraries that will readily format a string to be used in a onclick html attribute property.
I am using c# to dynamically generate an html page and am dynamically generating the javascript for some onclick events. I want to make sure characters such as &"\ ... etc does not cause the html to break or be ignored. For example in the following example of I wanted to display the alert message h\m, I wouldn't be able to do so unless I created separate logic to handle the \ and &:
function method1(inputValue){
alert(inputValue);
}
<input type="button" value="button1" onclick="method1('h\m')"/>