2011-09-01 49 views
0

我有这样的代码在我的aspx页面:这是正常的Page_Load中,以在点击一个UpdatePanel里面一个GridView的页面触发?

<form id="form2" runat="server"> 
    <asp:ScriptManager ID="ItemsScriptManager" runat="server" EnablePartialRendering="true" /> 
    <asp:Button runat="server" ID="SearchButton" OnClick="ItemsSearch" Text="Search" /> 
    <asp:UpdatePanel runat="server" ID="ItemsUpdatePanel"> 
    <ContentTemplate> 
     <asp:ObjectDataSource runat="server" ID="ItemsDS" 
     TypeName="TemplateGridViewODSPagingSorting.ItemDAO" SelectMethod="GetItems" /> 
     <asp:GridView runat="server" ID="ItemsGridView" DataSourceID="ItemsDS" 
     AllowPaging="true" AllowSorting="true" PageSize="4"> 
     </asp:GridView> 
    </ContentTemplate> 
    </asp:UpdatePanel> 
</form> 

按下GridView中的Page_Load被触发的另一页上,是一个局部回传此正常行为?

回答

1

使用UpdatePanel的部分呈现不会改变或影响ASP.NET的整个页面生命周期。

这是一个小技巧,用于在浏览器中重新渲染页面的某个区域(UpdatePanel),但没有其他更改,所以是的,正常情况下看到Page_Load和其他所有事件都会像往常一样触发;它必须是这样或它不会工作:)

1

是的,在更新面板更新,page_load将被调用与服务器的每个异步回发,克服这一点,你可以使用jQuery的Ajax。

相关问题