我有用戶控件ctrlinserimento與一個文本框,我有另一個用戶控件ctrlricerca與應該在ctrlinserimento中設置textbox.text到一個字符串(比如說'你好')。從另一個用戶控件設置一個用戶控件的文本框
我該怎麼辦?
ctrlinserimento
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication3
{
public partial class ctrlinserimento : System.Web.UI.UserControl
{
public string textbox1
{
set { TextBox1.Text = value; }
get { return TextBox1.Text; }
}
}
}
ctrlricerca
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;
namespace WebApplication3
{
public partial class ctrlricerca: System.Web.UI.UserControl
{
public ctrlinserimento i
{
set; get;
}
protected void Button1_Click(object sender, EventArgs e)
{
i.textbox1 = "Hello";
}
}
}
}
我的NullReferenceException上
i.textbox1 = "Hello";
可以anyboy幫助嗎? – Carmi 2014-09-25 16:34:50