下面代碼只能得到 一個 text 和一個 label 不能輸出 output.Write 中的值
ie IE 顯示 不能輸出"___"  未命名1.jpg (1.89 KB)IE 顯示 不能輸出"___"
2007-6-2 02:08
設計顯示能輸出"___"正確  未命名.jpg (2.3 KB)設計顯示能輸出"___"正確
2007-6-2 02:08
不知道是什麽原因啊.. 請各位幫幫忙
代码如下
///為什麽 output.Write("____" ); 不能輸出 值using System; using System.Collections.Generic;using System.ComponentModel;using System.Text;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace GameToolControl{    [DefaultProperty("Text")]    [ToolboxData("<{0}:ServerComtrol runat=server></{0}:ServerComtrol>")]    [Description("使用服務器控件的複合控制項")]    public class ServerComtrol : CompositeControl, INamingContainer    {        TextBox t = new TextBox();        Label l = new Label();        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()        {            t.Text = Text;            l.Text = Title;            Controls.Add(l);            Controls.Add(t);        }*/        /// <summary>        ///         /// </summary>        protected override void Render(HtmlTextWriter output)        {            t.Text = Text;            l.Text = Title;            t.RenderControl(output);//可以輸出            l.RenderControl(output);//可以輸出            output.Write("____" ); //不能輸出        }    }}相关贴子:http://bbs.blueidea.com/viewthread.php?tid=2752600&pid=3274561&page=1&extra=page%3D1#pid3274561