<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PerformCallback.aspx.cs" Inherits="PerformCallback" %>

<!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>
<script language="javascript" type="text/javascript"> //客户端处理下拉框选择项改变事件,client端aspxcombox下拉框改变事件为SelectedIndexChanged function OnEmployeesChanged(s) {
//PerformCallback事件实际上时dev系列控件客户端服务器端异步通信的"大使",通过PerfromCallback事件
//将客户端的通信要求传递给服务端,在服务端通过控件的callback事件来接受相关参数并进行页面异步刷新
//向服务器发送数据
alert("向服务发送:" + s.GetValue());
devcbxChi.PerformCallback(s.GetValue()); } </script>
<style type="text/css">
.style1
{
width: %;
}
.style2
{
width: 231px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div> <table class="style1">
<tr>
<td class="style2">
主动向服务器发起挑战</td>
<td> <dx:ASPxComboBox runat="server" ID="devcbxPar2"
EnableSynchronization="False" ClientInstanceName="devcbxPar2" Width="160px"
IncrementalFilteringMode="StartsWith">
<ClientSideEvents SelectedIndexChanged="function(s, e) { OnEmployeesChanged(s); }"></ClientSideEvents>
<Items>
<dx:ListEditItem Text="数据0" Value="" />
<dx:ListEditItem Text="数据1" Value="" />
<dx:ListEditItem Text="数据2" Value="" />
<dx:ListEditItem Text="数据3" Value="" />
</Items>
</dx:ASPxComboBox> </td>
</tr>
<tr>
<td class="style2">
向服务器发起挑战</td>
<td> <dx:ASPxComboBox runat="server" ID="devcbxChi" DropDownStyle="DropDownList" EnableIncrementalFiltering="True"
EnableSynchronization="False" ClientInstanceName="devcbxChi" Width="160px" oncallback="devcbxChi_Callback">
</dx:ASPxComboBox> </td>
</tr>
</table> <br /> </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 PerformCallback : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ } //服务器接收挑战
protected void devcbxChi_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
{
devcbxChi.Items.Add("这是来自客户端的数据:"+e.Parameter); devcbxChi.SelectedIndex = devcbxChi.Items.Count - ; }
}
04-27 23:29