日期:2014-05-17 浏览次数:20501 次
//原本的代码(onclick没有问题): <A:ButtonEx ID="btnAdvancedSearch_Up" runat="server" Text="预览结果" OnClick="btnAdvancedSearch_Click"/> <A:ButtonEx ID="btnCancel_Up" runat="server" Text="取消" OnClick="btnCancel_Click"/> //修改后的代码 <Anshu:ButtonEx ID="btnAdvancedSave_Up" runat="server" Text="保存检索条件到个人数据分类"/> <A:ButtonEx ID="btnAdvancedSearch_Up" runat="server" Text="预览结果" OnClick="btnAdvancedSearch_Click"/> <A:ButtonEx ID="btnCancel_Up" runat="server" Text="取消" OnClick="btnCancel_Click"/> //添加代码: <A:PopupPanelControl ID="FilterPopupPanel" runat="server" Width="400" Height="100" Caption="分类"> <A:ButtonEx ID="btnCategoryOk" runat="server" Text="确定" CausesValidation="false" CommandName="OK" OnClientClick="if(!onSave()) return false;" OnClick="btnCategoryOk_Click"/> <A:ButtonEx ID="btnCategoryCancel" runat="server" Text="取消" CausesValidation="false" CommandName="Cancel" OnClick="btnCategoryCancel_Click"/> <asp:HiddenField ID="hd_IsHide" runat="server" /> </A:PopupPanelControl> <script type="text/javascript"> //初始化 $(document).ready(function () { reload(); var isHide = $('<%=hd_IsHide.ClientID %>').val(); if (isHide == null || isHide == "hide"){ HideFilterPopupPanel(); } else{ ShowFilterPopupPanel(); } }); function reload() { Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); } function EndRequestHandler() { var isHide = $('<%=hd_IsHide.ClientID %>').val(); if (isHide == null || isHide == "hide"){ HideFilterPopupPanel(); } else{ ShowFilterPopupPanel(); } } function HideFilterPopupPanel(){ <%=FilterPopupPanel.ClientID%>.Hide(); } function ShowFilterPopupPanel(){ <%=FilterPopupPanel.ClientID%>.Show(); } function onSave() { var categoryName = <%=txtCategoryName.ClientID %>.GetValue();; options = { type: "POST", url: "……", contentType: "application/json;charset=utf-8", dataType: "json", async: false }; returnText = $.ajax(options).responseText; } </script> //aspx.cs页面:onLoad方法添加: btnAdvancedSave_Up.OnClientClick = string.Format("ShowFilterPopupPanel();return false;", FilterPopupPanel.ClientID);
btndisply.Attributes.Add("onclick", "javascript:return bntAddClick();");