how to keep the text in a textbox shown?
-
I have a textbox in the masterpage, then I input some text and click one button to redirect to another page, then the text in this textbox dispears, my question is that how to keep the text displayed even after redirect to annother page? I find one solution by using ((TextBox)Master.FindControl("TextBox_my")).Text =text_input; but later, I try to change the text and click the button again, the text in this textbox will be never changed and is always the original one. anyone can tell me why and any other solutions? thanks.
-
I have a textbox in the masterpage, then I input some text and click one button to redirect to another page, then the text in this textbox dispears, my question is that how to keep the text displayed even after redirect to annother page? I find one solution by using ((TextBox)Master.FindControl("TextBox_my")).Text =text_input; but later, I try to change the text and click the button again, the text in this textbox will be never changed and is always the original one. anyone can tell me why and any other solutions? thanks.
Well Seraph, The only case that your textbox value doesnt appear to the server side may arise if you textbox is either
Enabled = "false"
orReadonly = "true"
1 In case of<asp:textbox Enabled="false"
The form that holds the textbox doesnt submit itself. So the textbox will always appear to contain ""(Empty string) in the server side. 2. In case of<asp:textbox ReadOnly="true"
The form submits the textbox, but always the original value which is used to create the form retains in the server side. Thus any changes to the control doesnt appear. Check whether your textbox is enabled or Readonly. To transmit text from one page to another you might use querystring. Just place in your addressyourpage.aspx?x=name&y=age
But if the text is coming from the database, I would rather recommend you to fetch it from database every time, because, as this is web, the user might paste the link directly to the address bar rather than coming from the previous page. :cool::cool:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.