Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a form which contains two dropdown list and one asp textbox, when the
page postback the data that contained in the textbox is disappeared.

Thanks!
Posted

page postback the data that contained in the textbox is disappeared
Sounds like the viewstate of the control/page switched off.

OR

You must be using a code blank out the textboxes and not using IsPostback to do it only for the first time.
 
Share this answer
 
Comments
Mtyb 15-May-11 13:43pm    
I checked this, but it doesn't work.
The problem is that the textboxes that filed with the JavaScript is only being blanked.
Albin Abel 15-May-11 15:16pm    
These could be possible reasons. 5
The answer to your question is very simple. Anything which don't have runat="server" will not persist after postback. If you put runat="server", but want the client Id doesn't change than use the clientidmode="Static" and make sure no two ids are same.

If you have runat server attribute set, then Sandeep's answer explains why. You may be disabled viewstate or you initialize the textbox in the page_load to an empty string without a check for postback.

Explain more if you have still issues.
 
Share this answer
 
Comments
Sandeep Mewara 15-May-11 15:26pm    
Good 5!

I missed this part.
hi visit this link

http://forums.devshed.com/net-development-87/how-do-i-keep-a-variables-value-during-postback-119008.html
 
Share this answer
 
In your case looks like:
the code that fills the text box via javascript needs to be attached with onload event of page at script side
like:
try this in your javascript
<br />
<br />
function fillTextBox(){<br />
// fill your text box here.<br />
}<br />
<br />
window.attachEvent('onload', fillTextBox);<br />
<br />
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900