用户控件写到变量里?
和你说的有啥关系?你在控件里定义一个属性
public string result
{get;set;}结果附给属性, result="???"然后在外层使用 控件名.result 就可以抓到了

解决方案 »

  1.   

    什么结果,生成的html代码吗?如果是用HtmlTextWrite去做.
    控件.RenderControl(Writer
      

  2.   

    这是我测试成功过的例子:用户控件TestUserControl.aspx.cs private int _ID = 1;    public int ID
        {
            set
            {
                _ID = value;
            }
            get
            {
                return this._ID;
            }
        }     protected void Page_Load(object sender, EventArgs e)
        {
            Response.Write(_ID);//测试传进来的值
        }传值页面TestUserControl.aspx <%@ Reference Control="~/webUserControl.ascx" %>  <%--在页头加这一句代码--%>
    TestUserControl.aspx.cs  protected void Page_Load(object sender, EventArgs e)
        {
            Control c1 = Page.LoadControl("WebUserControl.ascx");     
            PlaceHolder1.Controls.Add(c1);
            WebUserControl w1 = (WebUserControl)c1;
            w1.ID = 2300; //这里设置用户控件的_ID的值
        }