任何人都可以告诉我为什么ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType, key, script.ToString, true);
返回最佳重载方法...有无效参数...我相信脚本是问题
StringBuilder script = new StringBuilder();
string key = "setTableName";
if (Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), key) == false)
{
script.Append("\ng_tableName ='");
script.Append(tableName + "';");
script.Append("\ng_layerName ='");
script.Append(layerName + "';");
}
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType, key, script.ToString, true);
答案 0 :(得分:1)
正如FrédéricHamidi所说,只需用script.ToString
替换script.ToString()
来调用函数而不是将其作为参数传递:
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), key, script.ToString(), true);