Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 使用UpdatePanel进行部分页面刷新_Asp.net_Updatepanel_Asp.net 4.0 - Fatal编程技术网

Asp.net 使用UpdatePanel进行部分页面刷新

Asp.net 使用UpdatePanel进行部分页面刷新,asp.net,updatepanel,asp.net-4.0,Asp.net,Updatepanel,Asp.net 4.0,我有一个与母版页关联的页面。我需要实现Ajax(基本上是想进行部分页面刷新)。 在这个页面中,我有网格和分页按钮(first/previous/last/next)、下拉列表和搜索。 所有这些都会更新网格 现在我有下面的代码 <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> 在 以下是类似html的网格/按钮/ContentTemplate标记启动后的搜索 最后,页面

我有一个与母版页关联的页面。我需要实现Ajax(基本上是想进行部分页面刷新)。 在这个页面中,我有网格和分页按钮(first/previous/last/next)、下拉列表和搜索。 所有这些都会更新网格

现在我有下面的代码

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>


以下是类似html的网格/按钮/ContentTemplate标记启动后的搜索

最后,页面留下了菜单/页脚/页眉和内容

</ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>


但这仍然是一个令人耳目一新的页面。

我对你拥有的和你想要的有点困惑

听起来您有一个
内容
控件,其中有一个
更新面板
。在
UpdatePanel
ContentTemplate
中,您的菜单中有所有的网格、按钮等

您只需要在
UpdatePanel
ContentTemplate
中设置要刷新的控件。除了
UpdatePanel
之外,您应该拥有的所有其他内容。如果在
UpdatePanel
之外有任何控件,则需要为
UpdatePanel
中的每个控件设置一个
trigger
来触发刷新,并告诉它要触发哪个事件

例如:

<asp:Button ID="btnTest" runat="server" Text="Test" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <!-- only your content that needs refreshing goes here -->
    <ContentTemplate>
    <Triggers>
       <asp:AsyncPostBackTrigger ControlID="btnTest" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>

我对你拥有的东西和你想要的东西有点困惑

听起来您有一个
内容
控件,其中有一个
更新面板
。在
UpdatePanel
ContentTemplate
中,您的菜单中有所有的网格、按钮等

您只需要在
UpdatePanel
ContentTemplate
中设置要刷新的控件。除了
UpdatePanel
之外,您应该拥有的所有其他内容。如果在
UpdatePanel
之外有任何控件,则需要为
UpdatePanel
中的每个控件设置一个
trigger
来触发刷新,并告诉它要触发哪个事件

例如:

<asp:Button ID="btnTest" runat="server" Text="Test" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <!-- only your content that needs refreshing goes here -->
    <ContentTemplate>
    <Triggers>
       <asp:AsyncPostBackTrigger ControlID="btnTest" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>