N
Nimrod Rotner
Hi All,
I can't understand what is the problem. I am using web control wich has a text box ob it and a public property that set and get that TextBox text value.
The compilation pass but when i try to get or set that property, i get: "Object Reference no set to an instance of an object."
Here is my Code:
----------------
public class WebUserControl1 : System.Web.UI.UserControl
{
private string num;
protected System.Web.UI.WebControls.TextBox txtName;
public string txt
{
get
{
return txtName.Text;
}
set
{
txtName.Text=value;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
WebUserControl1 ctl=new WebUserControl1();
Response.Write(ctl.txt);
I can't understand what is the problem. I am using web control wich has a text box ob it and a public property that set and get that TextBox text value.
The compilation pass but when i try to get or set that property, i get: "Object Reference no set to an instance of an object."
Here is my Code:
----------------
public class WebUserControl1 : System.Web.UI.UserControl
{
private string num;
protected System.Web.UI.WebControls.TextBox txtName;
public string txt
{
get
{
return txtName.Text;
}
set
{
txtName.Text=value;
}
}
private void Button1_Click(object sender, System.EventArgs e)
{
WebUserControl1 ctl=new WebUserControl1();
Response.Write(ctl.txt);