现有两个文件: UserControl.ascx, Test.Aspx1.UserControl.ascx页面为一段文字,如:“aaaaaaaaaaaaaaaaaaaaaaaaaaa.......aaaaaaaaaa”2.在ASPX页面托放一个Panel, protected void Page_Load(object sender, EventArgs e)
{
this.Panel1.Controls.Add(LoadControl("UserControl.ascx"));
}---------------------------
现如何获取Panel1内字符的长度与内容呢?
{
this.Panel1.Controls.Add(LoadControl("UserControl.ascx"));
}---------------------------
现如何获取Panel1内字符的长度与内容呢?
Control c = LoadControl("WebUserControl.ascx");
this.Panel1.Controls.Add(c);
foreach (Control con in c.Controls)
{
if (con is LiteralControl)
{
LiteralControl lc = con as LiteralControl;
Response.Write(lc.Text+",长度:"+lc.Text.Length.ToString());
}
}