zoukankan      html  css  js  c++  java
  • PerformCallback(珍藏版)

    <%@ 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
            {
                 100%;
            }
            .style2
            {
                 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="0" />
                <dx:ListEditItem Text="数据1" Value="1" />
                <dx:ListEditItem Text="数据2" Value="2" />
                <dx:ListEditItem Text="数据3" Value="3" />
            </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 - 1;
    
    
        }
    }
  • 相关阅读:
    创建用户自定义函数 SQL
    关于“该列没有包含在聚合函数或 GROUP BY 子句中”
    转Oracle性能参数—经典常用
    The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF 错误
    js定时刷新
    用户获取mac地址的方法
    聚集索引和非聚集索引的区别
    WCF启动报错:“进程不具有此命名空间的访问权限”的解决方法
    利用js文件加载js文件的方法
    C#下载的几种方法
  • 原文地址:https://www.cnblogs.com/qqhfeng/p/10283503.html
Copyright © 2011-2022 走看看