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,

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 = ""

in the event handler of the reset btn add for each textboxyou could try:


or something similar.

cannot remember exactly what the statement looks like but think its something like that

here we go this is what you need

textbox1.Text = "";

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.

<script type="vb">
Sub Page_Load


End Sub

Public Sub save_click()

textbox1.Text = textbox1.Text
textbox2.Text = textbox2.Text
textbox3.Text = textbox3.Text

End Sub

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.

much better way of doing it SheSaidImaPreggy!


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

for each control, disable the view state.

this way its never kept within the boxes.

for each control, disable the view state.

this way its never kept within the boxes.


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