天天看点

用户控件赋值

也可参考下图:

用户控件赋值

Insus.NET提供如下解决方法,仅供参考:

写一个接口,

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

/// <summary>

/// Summary description for ISetable

/// </summary>

namespace Insus.NET

{

    public interface ISetable

    {

        void SetTextBoxText(string value);

    }

}

用户控件实作这个接口,

using Insus.NET;

public partial class WebUserControl : System.Web.UI.UserControl,ISetable

    public void SetTextBoxText(string value)

        this.text2.Text = value;

然后在page的Button的Click事件中写,

 protected void Button1_Click(object sender, EventArgs e)

        ISetable set = (ISetable)this.WebUserControl1;

        set.SetTextBoxText(this.text1.Text);

测试:

用户控件赋值

测试代码: