简体   繁体   English

UpdatePanel-具有相同控件但事件不同的asyncpostbacktrigger和postbacktrigger

[英]UpdatePanel - asyncpostbacktrigger and postbacktrigger with same control but different events

In my UpdatePanel, the user can page, sort and filter a gridview all using AJAX, then they select a row which causes the post to post back and a textbox to be populated with the rows ID. 在我的UpdatePanel中,用户可以使用AJAX对页面视图进行分页,排序和筛选,然后选择导致帖子回发的行,并使用行ID填充文本框。

Problem is, it seems I can't register both an AsyncPostBackTrigger and a PostBackTrigger to the same control - so how would I accomplish this? 问题是,似乎我无法同时将AsyncPostBackTrigger和PostBackTrigger注册到同一控件-那么我将如何实现呢? Here are my triggers so far: 到目前为止,这是我的触发器:

            <Triggers> 
                        <asp:AsyncPostBackTrigger ControlID="btnFilter" EventName="Click" /> 

                             <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="PageIndexChanged" />
                   <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="PageIndexChanging" />
                   <asp:AsyncPostBackTrigger ControlID="GridView1" EventName="Sorting" />
                   <asp:PostBackTrigger ControlID="GridView1"/>
                    </Triggers> 

Maybe it is too late but I have a solution. 也许为时已晚,但我有解决方案。 It is no possible to register a synchronous and an asynchronous postback to the same control. 无法将同步和异步回发注册到同一控件。 What I do is to include a timer in the update panel and add a postback trigger to that timer. 我要做的是在更新面板中包括一个计时器,并向该计时器添加回发触发器。 So, in the event you want to cause the synchronous postback enable the timer and it'll cause the postback. 因此,如果您想引起同步回发,请启用计时器,它将导致回发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM