我在我的contentplaceholder中使用此规格。
http://www.dariancabot.com/projects/jgauge_wip/
脚本:
<link rel="stylesheet" href="Scripts/jgauge.css" type="text/css" />
<script type="text/javascript" src="Scripts/jquery-1.8.0.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/jgauge-0.3.0.a3.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/jQueryRotate.2.2.js"></script>
<script language="javascript" type="text/javascript" src="Scripts/excanvas.min.js"></script>
<script type="text/javascript">
var demoGauge1 = new jGauge(); // Create a new jGauge.
demoGauge1.id = 'jGaugeDemo1'; // Link the new jGauge to the placeholder DIV.
$(document).ready(function () {
demoGauge1.init(); // Put the jGauge on the page by initializing it.
});
</script>
标记:
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<div id="jGaugeDemo1" class="jgauge"></div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="myBtn" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="myBtn" runat="server" Text="Refresh" />
我在母版页上有脚本管理器:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>
但是在异步回发(击中&#39; myBtn&#39;)之后,测量仪消失了。救命。
答案 0 :(得分:0)
由于html元素需要在每次异步回发时重新创建更新面板,因此您需要在每次请求时重新生成计量器。
我没有使用该仪表控件的经验,但这样的事情可以解决这个问题
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(onEndRequest);
function onEndRequest(sender, args){
demoGauge1.init();
}