是否可以通过左侧面板(菜单)导航使用UpdatePanel控件? 在Main.master中有左侧菜单
<dx:ASPxNavBar ID="ASPxNavBar1" runat="server" AutoCollapse="True" EnableAnimation="True" Width="100%">
<dx:NavBarGroup Text="Group">
<Items>
<dx:NavBarItem NavigateUrl="Content/Content1.aspx" Text="Content1"></dx:NavBarItem>
<dx:NavBarItem NavigateUrl="Content/Content2.aspx" Text="Data Subject"></dx:NavBarItem>
</Items>
</dx:NavBarGroup>
</dx:ASPxNavBar>
我尝试使用UpdatePanel控件
尝试使用仅刷新内容<div class="contentPane">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" updatemode="conditional">
<ContentTemplate>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
但它不起作用;标题和菜单在浏览菜单时仍然重新加载。
Content1.aspx 和 Content2.aspx 文件只包含<asp:content>
标记内的常用内容
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" KeyFieldName="PK" Width="750px">
<Columns>
<dx:GridViewCommandColumn ShowNewButtonInHeader="True" VisibleIndex="0" ShowDeleteButton="True" ShowEditButton="True">
</dx:GridViewCommandColumn>
<dx:GridViewDataTextColumn FieldName="PK" ReadOnly="True" Visible="false" VisibleIndex="1">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="2">
</dx:GridViewDataTextColumn>
</Columns>
</dx:ASPxGridView>
</asp:Content>
答案 0 :(得分:1)
我想知道你为什么使用 UpdatePanel 是一个需要什么? 我会使用ASPxCallbackPanel这是 UpdatePanel 的优秀替代品,您可以使用它,因为您使用的是DevExpress控件
<script type="text/javascript">
var postponedCallbackRequired = false;
function OnListBoxIndexChanged(s, e) {
if(CallbackPanel.InCallback())
postponedCallbackRequired = true;
else
CallbackPanel.PerformCallback();
}
function OnEndCallback(s, e) {
if(postponedCallbackRequired) {
CallbackPanel.PerformCallback();
postponedCallbackRequired = false;
}
}
</script>
<dx:ASPxListBox runat="server" Height="221px" Width="100%" TextField="Name" DataSourceID="EmployeesDataSource1"
ValueField="EmployeeID" ID="ASPxListBox1" ClientInstanceName="ListBox" BackColor="Transparent">
<Border BorderWidth="0px"></Border>
<ItemStyle>
<Border BorderWidth="0px"></Border>
</ItemStyle>
<ClientSideEvents SelectedIndexChanged="OnListBoxIndexChanged" />
</dx:ASPxListBox>
<dx:ASPxCallbackPanel runat="server" ID="ASPxCallbackPanel1" Height="250px" ClientInstanceName="CallbackPanel" RenderMode="Table">
<ClientSideEvents EndCallback="OnEndCallback"></ClientSideEvents>
<PanelCollection>
<dx:PanelContent ID="PanelContent3" runat="server">
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
您可以看到完整的示例代码here