⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webemail.cs

📁 水晶报表详细资料水晶报表详细资料水晶报表详细资料
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Permissions;
using System.Text.RegularExpressions;
namespace WebEmail
{
    [
  AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal),
  AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal),
  DefaultProperty("Text"),
  ToolboxData("<{0}:WebEmail runat=server></{0}:WebEmail>")

]
    public class WebEmail : WebControl
    {
        [Bindable(true),
        Category("Appearance"),
        DefaultValue(""),
        Description("邮件地址")]
        public string strEmail;
       
        public virtual string Email
        {
            get
            {
                string s = (string)ViewState["strEmail"];
                return (s == null) ? String.Empty : s;
            }
            set
            {
                ViewState["strEmail"] = value;
            }
        }
        public string strText;
        [Bindable(true),
Category("Appearance"),
        DefaultValue(""),
        Description("文本值"),
        Localizable(true),
        PersistenceMode(PersistenceMode.InnerDefaultProperty)]
        public virtual string Text
        {
            get
            {
                string s = (string)ViewState["strText"];
                return (s == null) ? String.Empty : s;
            }
            set
            {
                ViewState["strText"] = value;
            }
        }

        protected override HtmlTextWriterTag TagKey
        {
            get
            {
                return HtmlTextWriterTag.A;
            }
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (strText == null)
                strText = "默认电子邮件";

        }

   
        protected override void AddAttributesToRender(
HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Href,
            "mailto:" + Email);
        }
        protected override void RenderContents( HtmlTextWriter writer)
        {
            writer.Write(Text);
       
        } 





      
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -