[一篮饭特稀原创,转载请注明出自http://www.cnblogs.com/wanghafan/p/3770779.html]
*.aspx:
1 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"> 2 </asp:ScriptManager> 3 <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="True" UpdateMode="Always"> 4 <ContentTemplate> 5 <div class="div_ControlButton"> 6 <asp:Button CssClass="btn_Common" runat="server" Text="保存" ID="btn_OK" OnClick="btn_OK_Click" /> 7 </div> 8 </ContentTemplate> 9 </asp:UpdatePanel>
*.aspx.cs:
1 protected void btn_OK_Click(object sender, EventArgs e) 2 { 3 .... 4 //JS脚本 5 System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "null", "alert('工程收入金额超过设计费批复金额5%');", true); 6 }
函数原型: