O
oterox
Hi!
I have a user control WebUserControl1.ascx with a textbox.I want to change
the text of the textbox from another page but i get the error "object
reference not set to an instance of the object".The code is:
protected System.Web.UI.WebControls.TextBox txtUC;
public string ucTexto
{
set
{
this.txtUC.Text = value;
}
}
And in the webform i have this in the code-behind:
protected WebUserControl1 uc1;
private void Page_Load(object sender, System.EventArgs e)
{
uc1.ucTexto = "ee";
}
and this in the aspx:
<%@ Register TagPrefix="uc1" TagName="WebUserControl1"
Src="WebUserControl1.ascx" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="uc.WebForm1" %>
<form id="Form1" method="post" runat="server">
<uc1:WebUserControl1 id="WebUserControl11"
runat="server"></uc1:WebUserControl1>
</form>
Thank you!
I have a user control WebUserControl1.ascx with a textbox.I want to change
the text of the textbox from another page but i get the error "object
reference not set to an instance of the object".The code is:
protected System.Web.UI.WebControls.TextBox txtUC;
public string ucTexto
{
set
{
this.txtUC.Text = value;
}
}
And in the webform i have this in the code-behind:
protected WebUserControl1 uc1;
private void Page_Load(object sender, System.EventArgs e)
{
uc1.ucTexto = "ee";
}
and this in the aspx:
<%@ Register TagPrefix="uc1" TagName="WebUserControl1"
Src="WebUserControl1.ascx" %>
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="uc.WebForm1" %>
<form id="Form1" method="post" runat="server">
<uc1:WebUserControl1 id="WebUserControl11"
runat="server"></uc1:WebUserControl1>
</form>
Thank you!