Can't write text into textbox in ASP.NET web app
- by dotnetdev
Hi,
I have an ASP.NET web application.
In the codebehind for the .ascx page (which I embed as below), I attempt to write a string to a textbox in a method like this:
Code for embedding control:
Control ctrl = Page.LoadControl("/RackRecable.ascx");
PlaceHolder1.Controls.Add(ctrl);
Method to make string for inserting into textbox:
string AppendDetails()
{
StringBuilder sb = new StringBuilder();
sb.Append("msg" + " " + textbox1.Text etc etc );
return sb.ToString();
}
Called as (in codebehind event handler for button click):
this.TextBox4.Text = AppendDetails();
I call it by using ATextBox.Text = AppendDetails (in the button click event handler). The textbox TextBox4 is in the designer file so I am confused why the text does not get written into this textbox (it is readonly and enabled).
When stepping through, the textbox4 control will successfully show the text I want it to display in quick watch but not in the actual page, it won't.
Any ideas?
Thanks