Hidistro.UI.Common.Controls/SubStringLabel.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace Hidistro.UI.Common.Controls
{
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class SubStringLabel : Literal
    {
        private int _strLength;
        private string _strReplace = "...";
        private string field;

        protected override void OnDataBinding(EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.Field))
            {
                object obj2 = DataBinder.Eval(this.Page.GetDataItem(), this.Field);
                if ((obj2 != null) && (obj2 != DBNull.Value))
                {
                    base.Text = (string) obj2;
                }
            }
            base.OnDataBinding(e);
        }

        protected override void Render(HtmlTextWriter writer)
        {
            if ((this.StrLength > 0) && (this.StrLength < base.Text.Length))
            {
                base.Text = base.Text.Substring(0, this.StrLength) + this.StrReplace;
            }
            base.Render(writer);
        }

        public string Field
        {
            get
            {
                return this.field;
            }
            set
            {
                this.field = value;
            }
        }

        public int StrLength
        {
            get
            {
                return this._strLength;
            }
            set
            {
                this._strLength = value;
            }
        }

        public string StrReplace
        {
后面还有 12 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。