AsyncPostBackTrigger 和 AsyncPostBackTrigger 有什么区别?回发触发?

发布于 2024-10-16 05:52:03 字数 62 浏览 2 评论 0原文

AsyncPostBackTrigger 和 AsyncPostBackTrigger 有什么区别?回发触发?

What is the difference between AsyncPostBackTrigger & PostBackTrigger?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

删除会话 2024-10-23 05:52:03

默认情况下,UpdatePanel 内部的控件会导致部分页面更新,外部的控件会导致回发,使用这些触发器可以根据需要更改此行为。

来自 http://seminaarit.codezone.fi /video/devdays-2007/track1/2/2-ASP-dotNET_AJAX_Extensions.ppt:(死链接)

AsyncPostBackTrigger

  • 将回发转换为异步回调 * 通常用于
    当 UpdatePanel 外部的控件回发时触发更新 * 如果
    ChildrenAsTriggers="false",可用于指定哪些控件
    UpdatePanel 内部应该回调而不是回发

回发触发

  • 让 UpdatePanel 内的控件回发。 * 通常用于
    当 ChildrenAsTriggers="true" 时允许某些控件回发

Controls inside an UpdatePanel by default cause a partial page update, controls outside cause a postback, using these triggers it is possible to change this behaviour as required.

From http://seminaarit.codezone.fi/video/devdays-2007/track1/2/2-ASP-dotNET_AJAX_Extensions.ppt: (dead link)

AsyncPostBackTrigger

  • Converts postbacks into async callbacks * Typically used to
    trigger updates when controls outside an UpdatePanel post back * If
    ChildrenAsTriggers="false", can be used to specify which controls
    inside UpdatePanel should call back rather than post back

PostBackTrigger

  • Lets controls inside UpdatePanel post back. * Typically used to
    allow certain controls to post back when ChildrenAsTriggers="true"
待天淡蓝洁白时 2024-10-23 05:52:03

这是一篇博客文章,解释了其中的差异:

在模板中
更新面板,有以下选项
AsyncPostBackTrigger 或
回发触发器。

默认情况下,控件位于
更新面板会触发正常
同步回发。这
AsyncPostBackTrigger“连接”这些
控件触发异步
回帖。反之,控制
在更新面板内声明将
触发异步调用
默认。 PostBackTrigger 简短
电路这个,并强制控制
进行同步回发。

Here's a blog post which explains the difference:

In the template in an
update panel, there are the options of
an AsyncPostBackTrigger or a
PostBackTrigger.

By default, controls outside of an
update panel will trigger a normal
synchronous post back. The
AsyncPostBackTrigger “wires” up these
controls to trigger an asynchronous
post back. Conversely, controls
declared inside an update panel will
trigger an asynchronous call by
default. The PostBackTrigger short
circuits this, and forces the control
to do a synchronous post back.

南街女流氓 2024-10-23 05:52:03

1. AsyncPostBackTrigger

它是强制页面异步回发的触发器,即 AJAX 方式。数据将在没有完整回发的情况下进行处理。当您使用登录等功能时,您可能会用到这个。

前任。您有两个下拉菜单,即国家/地区和州。选择国家/地区时应加载各州,并应在国家/地区更改时进行更改。

在这种情况下,您可以使用 AsyncPostBackTrigger,它将填充状态 ddl,而无需完全回发。

2. PostBackTrigger

它不遵循 AJAX 功能,而是像往常一样进行完整的回发(不使用 UpdatePanel)。在某些情况下,您可能不希望强制执行部分回发(如上面第 1 点所述)。

就像您在 UpdatePanel 中使用 FileUpload Control 一样,当您通过 AsyncPostBack 执行此操作时,您将不会向服务器获取任何值。它需要完整回发。在这种情况下,您应该使用此触发器。

1. AsyncPostBackTrigger

it is the one which enforces Asynchonous post back of the Page.., i.e. the AJAX way. The data will be transacted without full post back. When you are using functionalities like login, you may use this.

Ex. You are having two dropDowns Viz., Countries and States. the states should be loaded when a country is selected and it should be changed on Countries change.

You may use AsyncPostBackTrigger in this scenario, which will populate the states ddl without full post back.

2. PostBackTrigger

It is the one which does not follow the AJAX functionalities, but the full post back as usually(as without using UpdatePanel). Situtions are there where you would not like to enforce Partial Post back (as explained in Point 1. above).

Like you are having FileUpload Control withing the UpdatePanel and when you do it by AsyncPostBack, you will not get any values to the server. It requires Full PostBack. in such a case you should use this trigger.

不再让梦枯萎 2024-10-23 05:52:03

假设 Button1 位于更新面板内部,而 Button2 位于更新面板外部。
现在让我们了解更新面板外部的控件正在执行异步回发,而内部的控件则创建同步回发。

因此,由于两个按钮都位于“更新”面板内部的表单“Button1”上,而“bUtton2”位于其外部。
因此,顺便说一下,通过将 Button2 的 ID 及其事件名称提供给示例中给出的 Asyncpostback 触发器,我们假设现在它将像 Button1 一样使用 updatepanel 创建同步回发。

Suppose Button1 is inside your Update panel and Button2 is outside the update panel.
Now let's undertsand that the controls that are outside the update panel are doing a Asyncpostback and that are inside creates a Syncpostback.

So as both buttons are on a form Button1 in inside Update panel and bUtton2 is outside it.
So by the way by giving the Button2's ID and its Event name to the Asyncpostback Trigger as given in the example we suppose that now it will create a syncpostback with the updatepanel as like the Button1.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文