开发环境如下:
母版中用了UpdatePanel,子页面中再添加一个自定义控件,自定义控件中再添加一个导出按钮,导出按钮做将Gridview内容导出到Excel的动作。但因为UpdatePanel控件的原因导致Reponse.Write()无效。
这个时候可以在PageLoad事件中添加针对该控件的回发事件。
protected void Page_Load(object sender, EventArgs e) { try { //因为我的导出按钮写在GridControl中,所以这里用this.GridControlID.FindControl ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(this.viewcontrolB2.FindControl("btnviewcontrolB2Export")); } catch (Exception ex) { (this.Page as BasePage).AjaxAlert(ex); } }
浙公网安备 33010602011771号