设为首页  
联系我们  
加入收藏  
网页制作 冲浪宝典 图形图像 操作系统 软件教学 编程开发 认证考试 安全技术 站长专区 文学驿站 娱乐天地 游戏天地 办公软件
文章搜索
您的位置: 首页 >> 文章首页 >> 编程开发 >> 网络编程 >> ASP.NET技巧 >> 在asp.net中为Web用户控件添加属性和事件
精品推荐
ASP.NET技巧点击TOP10
·ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!
·ASP.NET2.0下含有CheckBox的GridView删除选定记录实例
·在ASP.NET中上传图片并生成缩略图的C#源码
·如何在上传的图片上写字
·asp.net 2.0中用GRIDVIEW插入新记录
·asp.net 2.0下一个标准GRIDVIEW功能的实现(不用datasource控件)
·asp.net中在前台用js增删ListBox的items
·在ASP.NET中显示进度条
·asp.net开发wap程序必备:识别来访手机品牌型号
·在asp.net中为Web用户控件添加属性和事件
网络编程点击TOP10
·ASP.NET 程序中常用的三十三种代码
·CHK文件恢复工具
·.NET 初 级 读 本
·c#操作word表格
·『原创』C#中TreeView类操作全攻略:建立树,新增节点,删除节点,修改节点,拖动节点,与Oracle数据库交互操作(一)
·我的.NET书架 (入门篇)
·从零开始学ASP.NET(基础篇)
·十天学会ASP.net之第一天
·用C#实现木马程序
·官方水晶报表 .NET 应用程序实例下载 (C#、Visual C++.NET)
精选专题

在asp.net中为Web用户控件添加属性和事件

作者: 来源:http://www.xgdown.com/ 时间:2005-11-5 0:25:41

在asp.net中为Web用户控件添加属性和事件(4)   }
  private void ButtonLogOut_Click(object sender, System.EventArgs e)
  {
   //注销代码省略
   OnLogInOutClick(this,new LogInOutEventArgs(LogInClickType.LongOut,true));
  }
  //验证函数
  private bool CustomValidate(string userName,string password)
  {
   //验证代码省略,假设通过
   return true;
  }
 }
}
另外一个文件定义了枚举和参数类:
using System;
namespace ZZ
{
 public class LogInOutEventArgs : EventArgs
 {
  private LogInClickType type;
  private bool result;
 
  public LogInOutEventArgs(LogInClickType type,bool result):base()
  {
   this.type = type;
   this.result = result;
  }
  public LogInClickType Type
  {
   get{return this.type;}
  }
  //操作结果,
  public bool Result
  {
   get{return this.result;}
  }
 }
 //操作类型
 public enum LogInClickType : int
 {
  LongIn,
  LongOut
 }
 //定义语言
 public enum Language
 {
  Chinese,
  English
 }
}
接下去看看在aspx页面里面使用。
新建一个Default.aspx页面,拖一个LogInOutControl用户控件到上面。
<%@ Register TagPrefix="UC1" TagName="LogInOutControl" Src="LogInOutControl.ascx" %>
<%@ Page language="c#" Codebehind="Default.aspx.cs" AutoEventWireup="false" Inherits="ZZ.Default" %>
<%@ Import Namespace="ZZ" %>
<HTML>
 <HEAD>
  <title>WebForm1</title>
 </HEAD>
 <body>
  <form id="Form1" method="post" runat="server">
   <FONT face="宋体">
    <uc1:LogInOutControl id="LogInOutControl1" runat="server">
    </uc1:LogInOutControl>
    <asp:Label id="LabelMsg" runat="server"></asp:Label>

共6页 9 7 [1] [2] [3] [4] [5] [68 :>

在asp.net中为Web用户控件添加属性和事件 相关文章:
在asp.net中为Web用户控件添加属性和事件 相关软件:
特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
转载请注明来源:http://www.xgdown.com