强制某些控件做了充分的回发? [英] Force certain controls to do a full postback?

查看:143
本文介绍了强制某些控件做了充分的回发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UpdatePanel内的一些控制。当中包括一些按钮。怎样才能让这些按钮,让他们做一个完整的回发,而不是局部的AJAX回发?

I have some controls within an UpdatePanel. Included are some buttons. How can I make these buttons so that they do a full postback rather than a partial AJAX postback?

推荐答案

下面是一个例子演示如何使用而不是AsyncPostbackTrigger的PostbackTrigger:

Here's an example demonstrating how to use the PostbackTrigger instead of the AsyncPostbackTrigger:

ASPX页面:

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Label ID="MyLabel" runat="server" />
        <br/>
        <asp:button ID="AjaxPostbackButton" Text="AJAX Postback" OnClick="AjaxPostbackButton_Click" runat="server" />
        <asp:button ID="FullPostbackButton" Text="Full Postback" OnClick="FullPostbackButton_Click" runat="server" />
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="AjaxPostbackButton" />
        <asp:PostBackTrigger ControlID="FullPostbackButton" />
    </Triggers>
</asp:UpdatePanel>

code背后:

Code Behind:

private void AjaxPostbackButton_Click(object sender, EventArgs e)
{
    MyLabel.Text = "Ajax Postback: " + DateTime.Now;
}

private void FullPostbackButton_Click(object sender, EventArgs e)
{
    MyLabel.Text = "Full Postback: " + DateTime.Now;
}

点击AJAX回传按钮将更新使用AJAX而完全回发按钮,将重新加载整个页面面板。

Clicking on the "AJAX Postback" button will will update the panel using AJAX whereas the "Full Postback" button will reload the entire page.

这篇关于强制某些控件做了充分的回发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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