解决方法如下
StringBuilder sb = new StringBuilder();
var str =@"<label><input type='checkbox' οnclick='adddelSingClass(""{0}"",""{1}"",""{2}"")' name='JZ_CID' value={0}> {1} </label>"; sb.Append(string.Format(str, temp.Classid, temp.Classname,"input"));
也就是在你的字符串前面加 符号,并且你的脚本的引号要变成2个双引号 ,再来举一个列子
sb.AppendFormat(@"<label><input type='checkbox' name='boxSend' οnclick='adddelSingClass(""{0}"",""{1}"",""{2}"")' value={0}> {1} </label>", xgroup.Groupid, xgroup.Groupname, "input");