Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8361577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:43:49+00:00 2026-06-09T11:43:49+00:00

Is it possible that Page_Unload event can reset textbox.text? I found that can’t! Markup

  • 0

Is it possible that Page_Unload event can reset textbox.text? I found that can’t!

Markup

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:TextBox ID="txt" runat="server"></asp:TextBox>
    <asp:Button ID="btn" runat="server" Text="Do something1" />
    <asp:Button ID="btn1" runat="server" Text="Do something2" />
    <asp:Button ID="btn2" runat="server" Text="Do something3" />
    </div>
    </form>
</body>
</html>

Code behind

Protected Sub btn_Click(sender As Object, e As System.EventArgs) Handles btn.Click
    Method1()
End Sub

Protected Sub btn1_Click(sender As Object, e As System.EventArgs) Handles btn1.Click
    Method2()
End Sub

Protected Sub btn2_Click(sender As Object, e As System.EventArgs) Handles btn2.Click
    Method3()
End Sub

Private Sub Method1()
    'Do something
End Sub

Private Sub Method2()
    'Do something
End Sub

Private Sub Method3()
    'Do something
End Sub

Protected Sub Page_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
    txt.Text = String.Empty
End Sub

You may think that putting the txt.Text = String.Empty in every method is the best way to solve this problem, but how about if I have 80 buttons, then I have to put the txt.Text = String.Empty in 80 button click event. Does there any better way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:43:50+00:00Added an answer on June 9, 2026 at 11:43 am

    Look at the asp.net page life cycle.

    The event that is called after all button clicks is PreRender.

    You can override the OnPreRender to clear such text.

    Page life cycle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible that the html page loaded, cannot be refreshed or reloaded by
Possible Duplicate: In JavaScript can I make a “click” event fire programmatically for a
Is it possible to create advance search option like that of google page in
I need to write a module that gives me a page will all possible
Is it possible that when calling multiple times this function: void Func(String spr, PictureBox
Is it possible that there are more than one certificate chain built during the
It is quite possible that I'm just looking for help finding the name of
Is it possible that when you have a webpage, when you open the PDF,
It is quite possible that I may not have got the point, but I
is it possible that my mingw 3.4.5 installation is faulty? or is this provided

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.