I have two WebUserControl
.
1. UC_1.axcx
2. UC_2.ascx
I tried to access UC_2.ascx.cs
method from my UC_1.axcx.cs
. Below is
UC_1.ascx.cs
method.
protected void Page_Load(object sender, EventArgs e)
{
UC_2 objUC = new UC_2();
objUC.assignName("123');
}
UC_2.ascx.cs
:
public string assignName(string nameParam)
{
TextBox1.Text = nameParam; //Here i am getting object null error.
retrun "access UC_2 successfully.";
}
While accessing UC_2
method from UC_1
, I am getting:
Object reference not set to an instance of an object.
How to solve this issue ?