博客
关于我
asp.net代码练习 work015 回调技术
阅读量:310 次
发布时间:2019-03-03

本文共 1552 字,大约阅读时间需要 5 分钟。

webform1.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="work015.WebForm1" %>
回调技术
用户名
密码

webform1.aspx.cs

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace work015{    public partial class WebForm1 : System.Web.UI.Page, ICallbackEventHandler    {        string result = "";        protected void Page_Load(object sender, EventArgs e)        {            ClientScriptManager csm = Page.ClientScript;            //参数5,true表示异步,false表示同步            string reference = csm.GetCallbackEventReference(this, "args", "Success", "", "Error", false);            string callbackScript = "function CallServerMethod(args,context) {\n" +                reference + ";\n}";            csm.RegisterClientScriptBlock(this.GetType(), "CallServerMethod", callbackScript, true);        }        public void RaiseCallbackEvent(string eventArgs)        {            if (eventArgs.ToLower().IndexOf("admin") != -1)            {                result = string.Format("{0}已被注册", eventArgs);            }            else            {                result = eventArgs + "可以注册";            }        }        public string GetCallbackResult()        {            return result;        }    }}

 

转载地址:http://yirm.baihongyu.com/

你可能感兴趣的文章
Mysql 知识回顾总结-索引
查看>>
Mysql 笔记
查看>>
MySQL 精选 60 道面试题(含答案)
查看>>
mysql 索引
查看>>
MySQL 索引失效的 15 种场景!
查看>>
MySQL 索引深入解析及优化策略
查看>>
MySQL 索引的面试题总结
查看>>
mysql 索引类型以及创建
查看>>
MySQL 索引连环问题,你能答对几个?
查看>>
Mysql 索引问题集锦
查看>>
Mysql 纵表转换为横表
查看>>
mysql 编译安装 window篇
查看>>
mysql 网络目录_联机目录数据库
查看>>
MySQL 聚簇索引&&二级索引&&辅助索引
查看>>
Mysql 脏页 脏读 脏数据
查看>>
mysql 自增id和UUID做主键性能分析,及最优方案
查看>>
Mysql 自定义函数
查看>>
mysql 行转列 列转行
查看>>
Mysql 表分区
查看>>
mysql 表的操作
查看>>