好的...还没有回答...所以这是我的工作。
HtmlGenericControl dynDiv = new HtmlGenericControl("div");
dynDiv = Replace(dynDiv, "'", "'");
public HtmlGenericControl Replace(HtmlGenericControl htmlGenericControl, string
source, string target)
{
StringWriter sw = new StringWriter();
HtmlTextWriter htmlTextWriter = new HtmlTextWriter(sw);
htmlGenericControl.RenderControl(htmlTextWriter);
string str = sw.GetStringBuilder().ToString();
str = str.Replace(source, target);
htmlGenericControl.InnerHtml = str;
return htmlGenericControl;
}
小错误 - 由于某种原因,复制在ResultPage.aspx的“格”的标签,但它不会干扰代码,所以我不在乎。
但 - 当我试图用它为HtmlGenericControl script = new HtmlGenericControl("script");
它打破了代码。所以在这里,解决方法是直接在ResultPage.aspx - > view Designer - > source中植入实际的java脚本代码。
<script type="text/javascript">
My Script (with the apostrophe...)
</script>
享受! :)
嗨,当我在我的源代码中找到/替换一切正常再次......这就是为什么我仍然认为这是问题... –
也许问题是与我的HTML标题格式 –