<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AspxCallbackPanel.aspx.cs" Inherits="AspxCallbackPanel" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxCallbackPanel ID="ASPxCallbackPanel1" runat="server" Width="590px" ClientInstanceName="CallbackPanel1"
Height="173px" oncallback="ASPxCallbackPanel1_Callback">
<Styles>
<Panel BackColor="AppWorkspace">
</Panel>
</Styles>
<PanelCollection>
<dx:PanelContent runat="server">
<asp:MultiView ID="MultiView" runat="server">
<asp:View ID="View1" runat="server">
<table>
<tr>
<td valign="top">
<dx:ASPxLabel ID="ASPxLabel1" runat="server" Text="♣我是谁?不要告诉我是上班族,班族。"
Font-Bold="True">
</dx:ASPxLabel>
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">
<table>
<tr>
<td valign="top">
<dx:ASPxLabel ID="ASPxLabel3" runat="server" Text="♣许多人不知道自己失去过什么悟吧!"
Font-Bold="True">
</dx:ASPxLabel>
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View3" runat="server">
<table>
<tr>
<td valign="top">
<dx:ASPxLabel ID="ASPxLabel5" runat="server" Text="♣一个人吻你,你一定被人深爱;死"
Font-Bold="True">
</dx:ASPxLabel>
</td>
</tr>
</table>
</asp:View>
</asp:MultiView>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxCallbackPanel>
<hr/>
<dx:ASPxListBox ID="ASPxListBox1" runat="server" ClientInstanceName="ListBox"
Height="331px" Font-Size="Larger" Width="271px">
<Items>
<dx:ListEditItem Text="雷语1" Value="" />
<dx:ListEditItem Text="雷语2" Value="" />
<dx:ListEditItem Text="雷语3" Value="" />
</Items>
<ClientSideEvents SelectedIndexChanged="function(s, e) {
var item = ListBox.GetSelectedItem();
CallbackPanel1.PerformCallback(item.value); <!--此行就是调用AspxCallbackPanel的回调方法 -->
}" Init="function(s, e) {
ListBox.SetSelectedIndex();
CallbackPanel1.PerformCallback();
}"
/>
</dx:ASPxListBox>
<br />
<span style="font-family:'宋体';font-size:10pt;">接下来再放置一个<span lang="en-us"
xml:lang="en-us">MultiView</span>控件,设置多个<span lang="en-us" xml:lang="en-us">View</span>,让他显示不同的内容<span
lang="en-us" xml:lang="en-us">,</span>注意,<span lang="en-us"
xml:lang="en-us">MultiView</span>是放置在<span lang="en-us" xml:lang="en-us">ASPCallbackPane</span>的<span
lang="en-us" xml:lang="en-us"><PanelCollection></span>中。如下</span></div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AspxCallbackPanel : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ASPxCallbackPanel1_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
{
MultiView.ActiveViewIndex = Convert.ToInt32(e.Parameter);
}
}