我试试这个,它在我调用的行中给出了标题中提到的错误String.Format
。
public static void JqueryDialogue(string divId)
{
String script = String.Format(
"$(document).ready(function(){ $('#{0}').dialog('open'); });",
divId);
// Gets the executing web page
Page page = HttpContext.Current.CurrentHandler as Page;
string codeId = "openDialoge" + divId.ToString();
// Checks if the handler is a Page and that the script isn't already on Page
if (page != null && !page.ClientScript.IsClientScriptBlockRegistered(codeId))
{
page.ClientScript.RegisterStartupScript(
typeof(JavascriptHelper),
codeId,
script,
true);
}
}