Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Textbox from Codebehind???

Status
Not open for further replies.

KenniM

Programmer
Nov 27, 2002
25
0
0
DK
Maybe I should get some sleep, 'cause it seems that even the simplest things are becoming big problems now!

Problem:

1) I have a asp:Textbox named Textbox_Subject on my aspx.
2) I have a Codebehind file for the above aspx.
?) How do I clear/alter the text in that Textbox from within my Codebehind file???

I tried something like: Textbox_Subject.Text = "bla bla";
But it doesn't work!

Can anyone help me here!
Thanks!


 
That should work, it just depends where you're doing it.

Can you post more of your code for us?

D
 
Okay I figured it out! Here's the all too simple solution to my problem!

In my Codebehind file I forgot to declare my Textbox controls! Simply adding the following line made me able to access my <asp:Textbox ID=&quot;Textbox_Subject&quot;> 's attributes.

I declared it this way:
public TextBox TextBox_Subject;

Fantastic! :D

Hope this can be of help to someone with a similar problem!

Cheers
Kenni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top