YKT_WebControls/ServerControl1.cs

(开头部分) 1KB

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

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.Collections.Specialized;

namespace YKT_WebControls
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:LabelTextBox runat=server></{0}:LabelTextBox>")]
    public class LabelTextBox : WebControl, INamingContainer
    {
        public string Text
        {
            get
            {
                object o = ViewState["Text"];
                if (o == null)
                    return String.Empty;
                return (string)o;
            }
            set { ViewState["Text"] = value; }
        }
        public string Title
        {
            get
            {
                object o = ViewState["Title"];
                if (o == null)
                    return String.Empty;
                return (string)o;
            }
            set { ViewState["Title"] = value; }
        }
        protected override void CreateChildControls()
        {
            Controls.Clear();
            //CreateControlHierarchy();
            ClearChildViewState();
        }
        //protected virtual void CreateControlHierarchy()
        //{
        //    TextBox t = new TextBox();
        //    Label l = new Label();
        //    t.Text = Text;
        //    l.Text = Title;
        //    Controls.Add(l);
        //    Controls.Add(t);
        //}

        protected override void Render(HtmlTextWriter writer)
        {
            string markup = String.Format(
 "<span>{0}</span><input type=text value='{1}' name='{2}'>",
 Title, Text, ClientID);
            markup += String.Format(
后面还有 10 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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