using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;namespace MyControl
{
/// <summary>
/// WebCustomControl1 的摘要说明。
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : WebControl,INamingContainer,IPostBackDataHandler
{
TextBox txt;
private string text; [Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return text;
} set
{
text = value;
}
} /// <summary>
/// 将此控件呈现给指定的输出参数。
/// </summary>
/// <param name="output"> 要写出到的 HTML 编写器 </param>
protected override void CreateChildControls()
{
txt = new TextBox();
txt.Text="dddddddddd";
txt.ID = "txt1";
this.Controls.Add(txt);
this.Controls.Add(new LiteralControl("<Input type=submit value=submit/>"));

}
#region IPostBackDataHandler 成员 public void RaisePostDataChangedEvent()
{
// TODO:  添加 WebCustomControl1.RaisePostDataChangedEvent 实现
} public bool LoadPostData(string postDataKey, System.Collections.Specialized.NameValueCollection postCollection)
{
// TODO:  添加 WebCustomControl1.LoadPostData 实现
Page.Response.Write(postCollection[txt.ClientID]);
return false;
} #endregion
}
}
--------------------------------------------
上面这句,为什么显示不出提交的值???Page.Response.Write(postCollection[txt.ClientID]);