stringBuilder抛出无效参数
本文关键字:参数 无效 stringBuilder | 更新日期: 2023-09-27 18:15:30
谁能告诉我为什么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);
As fracimdsamric Hamidi说只需将script.ToString
替换为script.ToString()
来调用函数,而不是将其作为参数传递:
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), key, script.ToString(), true);