中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档 | 网通镜像
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > .NET > 临时文章
动态装载
作者:未知 时间:2004-11-11 12:12 出处:Blog 责编:chinaitpower
              摘要:暂无

1: 基类 SkinnedForumWebControl : WebControl, InamingContainer

1)     默认构造函数

   public SkinnedForumWebControl() {

   // Attempt to get the current user

      user = Users.GetLoggedOnUser();

   // Is the user not availabe - must be anonymous

      if (user == null)

         Users.TrackAnonymousUsers();

   // Set the siteStyle for the page

      if (user != null)

         skinName = user.Skin;

      else

         skinName = Globals.Skin;

   // If we have an instance of context, let's attempt to

   // get the ForumID so we can save the user from writing

   // the code

      if (null != Context) {

         GetPostIDFromRequest();

         GetForumIDFromRequest();

         GetForumGroupIDFromRequest();

         GetReturnURLFromRequest();

       }           

   }

2)     4个自定义的方法

   // Retrieves the PostID,ForumID,ForumGroupID, ReturnUrl from the request querystring/post.

       private void GetPostIDFromRequest()

      private void GetForumIDFromRequest()

       private void ForumGroupID ()

       private void GetReturnURLFromRequest ()

3)      重写方法

     protected override void CreateChildControls() {

        Control skin;

     // Load the skin(.ascx) as an object instance

        skin = LoadSkin();

     // to be overrided , Initialize the control template and populate the control with values          

InitializeSkin(skin);

        Controls.Add(skin);

     }

  4) 属性访问器

2: 继承的类

1)      属性

   // Assign a default template name

      string skinFilename = "Skin-Login.ascx";

   // controls in (.ascx) template

        TextBox username;

        TextBox password;

        Button loginButton;

        CheckBox autoLogin;

2)     构造函数

   public Login() : base() {

   // Assign a default template name

      if (SkinFilename == null)

      SkinFilename = skinFilename;

   }

3)     重写2个基类方法

     protected override void CreateChildControls() {

     // If the user is already authenticated we have no work to do

        if (Page.Request.IsAuthenticated)

        return;

        base.CreateChildControls();

     }

     override protected void InitializeSkin(Control skin) {

     // Find the login button

        loginButton = (Button) skin.FindControl("loginButton");

        loginButton.Click += new System.EventHandler(LoginButton_Click);

     // add more ……

     }

4)     自定义控件方法

     public void LoginButton_Click(Object sender, EventArgs e)
关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有