问题来自http://topic.csdn.net/u/20120226/15/09b1fd42-b587-483b-b4df-9cba2ef3d0ad.html 也可参考下图:
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); }
测试:
测试代码: http://download.cnblogs.com/insus/ASPDOTNET/SetUserControlTextboxText.rar
|
|
来自: 悟静 > 《.net和asp.net》