如何将更新窗格回传以导出到Exle功能? [英] How to postback the Update panle for export to excle functionality?

查看:81
本文介绍了如何将更新窗格回传以导出到Exle功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.Net页和"Master"页,还有一些"Users Controls".

该页面包含一个更新面板"和"Ajax选项卡面板"
在选项卡面板的选项卡更改上,我将按选项卡位置加载我的用户控件".
现在我想要这样的东西.
在某些用户控件中,我放置了用于将Grid View数据导出到Excel文件的链接按钮.
我以前使用自己的功能进行过此操作,但只有在页面没有任何更新面板时才有效,如果有更新面板,则用于导出数据的按钮将在侧面更新面板中注册为回发触发器.

所以我想将我的用户控件导出按钮注册到我的页面的更新"面板的回发触发器.

I have one ASP.Net page with Master page and some User Controls there.

That page contains one Update Panel and Ajax Tab Panel
on tab change of tab panel i will load My User Control as per tab position.
now what i want some thing like this.
in some user control i put link button for exporting data of Grid View to excel file.
i did this before with my own function but it will work only when the page is not having any update panel and if having update panel then the button which is used to export data will registered as a post back trigger in side update panel.

so i want to register my user controls export button to my Page''s Update panel''s post back trigger.
how to do this.?

推荐答案

我想将我的用户控件导出按钮注册到页面"的更新"面板的回发触发器
您所需要做的就是将该按钮注册为该更新面板的PostbackTrigger.
i want to register my user controls export button to my Page''s Update panel''s post back trigger
All you need is to register the button as PostbackTrigger for that update panel.
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
    <ContentTemplate>
       Other controls here... 
       <asp:Button id="UploadButton"

           Text="Upload file"

           OnClick="UploadButton_Click"

           runat="server">
       </asp:Button>
    </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="UploadButton" />
    </Triggers>
</asp:UpdatePanel>


参考: MSDN:PostBackTrigger类 [


Refer: MSDN: PostBackTrigger Class[^]


更新面板具有AsyncPostBack触发器,您可以在其中嵌入按钮并指向相应的面板,这可以解决您的问题
Update Panel has AsyncPostBack triggers, within which you can embed button and point to the respective panel, this solves your problem


用于从子控件代码后面的页面向更新面板触发器添加控件ID ,只需使用它即可.

像这样使用与该更新面板关联的脚本管理器.
像这样通过您的控制.
For adding Controll id to Update Panel Trigger from Child Control Codebehind page, simply use this.

use your script manager associated with that update panel like this.
pass your control like this.
ToolkitScriptManager.GetCurrent(Page).RegisterPostBackControl(lnkBhaItemsExportToExcel)


这篇关于如何将更新窗格回传以导出到Exle功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆