用户控件赋值
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
共同学习,写下你的评论
评论加载中...
作者其他优质文章