ServerMonitoringDetails objServerMonitorings = new ServerMonitoringDetails();
objServerMonitorings = ServerMonitoringBusinessManager.GetAllIpDetailsByIpAddress();
StringBuilder sbPhysicalMemory = new StringBuilder();
sbPhysicalMemory.Append("Physical Memory");
sbPhysicalMemory.Append("<div class=\"MemoryFixed\">");
sbPhysicalMemory.Append("<a href=\"ServerMonitoringGraphDetails.aspx?Ip=KHUSHVINDER-PC\">KHUSHVINDER-PC</a>");
ScriptManager.RegisterStartupScript(this.divPhysicalMemory, this.Page.GetType(), "script", "<script type='text/javascript'>bind(div1,50,200);</script>", false);
sbPhysicalMemory.Append("<div id=\"div1\">");
sbPhysicalMemory.Append("</div>");
sbPhysicalMemory.Append("</div>");
divPhysicalMemory.InnerHtml = sbPhysicalMemory.ToString();
StringBuilder sbVirtualMemory = new StringBuilder();
sbVirtualMemory.Append("Virtual Memory");
sbVirtualMemory.Append("<div class=\"MemoryFixed\">");
sbVirtualMemory.Append("<a href=\"ServerMonitoringGraphDetails.aspx?Ip=KHUSHVINDER-PC\">KHUSHVINDER-PC</a>");
ScriptManager.RegisterStartupScript(this.divVirtualMemory, this.Page.GetType(), "script", "<script type='text/javascript'>bind(divVM,100,200);</script>", false);
sbVirtualMemory.Append("<div id =\"divVM\">");
sbVirtualMemory.Append("</div></div>");
divVirtualMemory.InnerHtml = sbVirtualMemory.ToString();
嗨,这是我上面的代码,我在代码后面两次调用相同的函数但没有工作
答案 0 :(得分:0)
从@ banana的解释中了解到它偶尔会起作用, @ user3840910请检查您的使用情况
ScriptManager.RegisterStartupScript
该方法的第三个参数应该是要注册的脚本的唯一标识符。
请参阅:http://msdn.microsoft.com/en-us/library/bb359558(v=vs.110).aspx
另外@ user3840910,最好在发布时格式化脚本,不要错过javasript行末尾的分号。