• 创建用户自定义控件的方法之一


    一:header.asc
    <table width="100%" border="0" cellpadding="0" cellspacing="0" background="../../images/s2pindex_11.gif"ID="Table6">
     <tr>
      <td width="7" height="29" valign="top"><img src="../../images/s2pindex_10.gif" width="7" height="29"></td>
      <td width="510" valign="middle" style="PADDING-LEFT:10px; FILTER:glow(color=#ffffff,strength=3); COLOR:#023490; PADDING-TOP:3px; LETTER-SPACING:8px">
       <ASP:PLACEHOLDER id="phJxtTitle" RUNAT="server"></ASP:PLACEHOLDER></td>
      <td width="65">
      </td>
      <td width="9" valign="top"><img src="../../images/s2pindex_12.gif" width="9" height="29"></td>
     </tr>
    </table>
    <%@ Control Language="c#" AutoEventWireup="false" Codebehind="Top1.ascx.cs" Inherits="s2p.Application.Teacher.Controls.Top1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

    二:header.asc.cs

    namespace s2p.Application.Teacher.Controls
    {
     using System;
     using System.Data;
     using System.Drawing;
     using System.Web;
     using System.Web.UI;
     using System.Web.UI.WebControls;
     using System.Web.UI.HtmlControls;
     using System.Text;
     using s2pDatabasePublic;

     /// <summary>

     /// <summary>
     ///  Top1 的摘要说明。
     /// </summary>
     public class Top1 : System.Web.UI.UserControl
     {
      protected System.Web.UI.WebControls.PlaceHolder phJxtTitle;

      //准备属性
      private string _JxtTitle="";//当前页面标题

      /// <summary>
      /// 当前页面标题
      /// </summary>
      public string JxtTitle
      {
       get
       {
        return _JxtTitle;
       }
       set
       {
        _JxtTitle=value;
       }
      }

      private void Page_Load(object sender, System.EventArgs e)
      {
       // 在此处放置用户代码以初始化页面
       phJxtTitle.Controls.Add(new LiteralControl(JxtTitle));
      }

      #region Web 窗体设计器生成的代码
      override protected void OnInit(EventArgs e)
      {
       //
       // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
       //
       InitializeComponent();
       base.OnInit(e);
      }
      
      /// <summary>
      ///  设计器支持所需的方法 - 不要使用代码编辑器
      ///  修改此方法的内容。
      /// </summary>
      private void InitializeComponent()
      {
       this.Load += new System.EventHandler(this.Page_Load);

      }
      #endregion
     }
    }
    <%@ Control Language="c#" AutoEventWireup="false" Codebehind="Top1.ascx.cs" Inherits="s2p.Application.Teacher.Controls.Top1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%><%@ Control Language="c#" AutoEventWireup="false" Codebehind="Top1.ascx.cs" Inherits="s2p.Application.Teacher.Controls.Top1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%><%@ Control Language="c#" AutoEventWireup="false" Codebehind="Top1.ascx.cs" Inherits="s2p.Application.Teacher.Controls.Top1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%><%@ Control Language="c#" AutoEventWireup="false" Codebehind="Top1.ascx.cs" Inherits="s2p.Application.Teacher.Controls.Top1" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

  • 相关阅读:
    数据库分页
    oracle查询某一个字段的数量总和
    JSON.stringify()和JSON.parse()
    oracle查询以当前年份为准的近些年数据
    关于oracle中日期使用
    最简单的js确认框!
    oracle插入数据时解决和旧数据id的冲突
    CentOS查看内核版本,位数,版本号
    CentOS 使用命令设置代理
    CentOS 编译源码安装MySQL-5.6.16
  • 原文地址:https://www.cnblogs.com/JimZhang/p/227229.html
Copyright © 2020-2023  润新知