User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,815 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,566 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 726 | Replies: 8
Reply
Join Date: Dec 2007
Posts: 25
Reputation: IT_Techno is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
IT_Techno IT_Techno is offline Offline
Light Poster

reset page problem

  #1  
Mar 17th, 2008
hi every one,

i need some helpe on asp.net with c# components ,
i have some text boxs and labels i need to reset the textbos and labels' text to be empty when i click explorer back button i need to rest them to empty and when i click refresh button to reset them also to empty . put when i click button for example "save button" i do not need to reset them to empty if the page postback with errors or without errors because i have required fields need not to set to empty

please helpe me,

Many Thanks,
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: reset page problem

  #2  
Mar 17th, 2008
I am not quite sure I understand what you mean. is it that you need:
1.reset button to reset textboxes to ""
2.refresh button textboxes =""
3.back button tb = ""
?
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: reset page problem

  #3  
Mar 17th, 2008
in the event handler of the reset btn add for each textboxyou could try:

textbox1.SetText("");

or something similar.

cannot remember exactly what the statement looks like but think its something like that
Last edited by majestic0110 : Mar 17th, 2008 at 9:10 am.
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: reset page problem

  #4  
Mar 17th, 2008
here we go this is what you need
textbox1.Text = "";
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: reset page problem

  #5  
Mar 17th, 2008
Best bet, is to do this:

1. Check to see if the page is a postback.
2. Within the event that was accessed (a button_click), set your textboxes.
  1. <script type="vb">
  2. Sub Page_Load
  3.  
  4. ....
  5. ....
  6.  
  7. End Sub
  8.  
  9. Public Sub save_click()
  10.  
  11. textbox1.Text = textbox1.Text
  12. textbox2.Text = textbox2.Text
  13. textbox3.Text = textbox3.Text
  14.  
  15. End Sub
  16. </script>
If you do not set a value to these textboxes, they will be erased. However, if you do set a value, they should be set to the value you specified.
Last edited by SheSaidImaPregy : Mar 17th, 2008 at 9:28 am.
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: reset page problem

  #6  
Mar 17th, 2008
much better way of doing it SheSaidImaPreggy!
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Dec 2007
Posts: 25
Reputation: IT_Techno is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
IT_Techno IT_Techno is offline Offline
Light Poster

Re: reset page problem

  #7  
Mar 18th, 2008
hi

you do not understand my question ,

i have build asp.net with c# web page this page supposed to send some information to Sql DB and then go directly to another web page when i do that it work will and go to the next page put when i go back to the past page i found that information i have sent to DB stell found on the page inside the textbox . the problem is i need to reset that text box and label text to empty as if i opend it for first time that does not happen if you can helpe me.

thanks alot
Last edited by IT_Techno : Mar 18th, 2008 at 4:08 am.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: reset page problem

  #8  
Mar 18th, 2008
for each control, disable the view state.

this way its never kept within the boxes.
Reply With Quote  
Join Date: Dec 2007
Posts: 25
Reputation: IT_Techno is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
IT_Techno IT_Techno is offline Offline
Light Poster

Re: reset page problem

  #9  
Mar 19th, 2008
Originally Posted by SheSaidImaPregy View Post
for each control, disable the view state.

this way its never kept within the boxes.



hi

i have done as you say but it does not work when i go back to that page from Explorer back it does not reset fields. the back button i mean as in pic
Attached Images
File Type: bmp untitled.bmp (82.7 KB, 2 views)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 5:40 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC