clear asp controls

Posted on 2011-10-12
Medium Priority
Last Modified: 2012-05-12
i have a aspx page with asp textbox, dropdown controls, i would like it to reset the values, for example clear the user typed value in the text box in a button click event or post back. what would be best way to achieve this?
Question by:singsunn
  • 2
  • 2
LVL 17

Accepted Solution

sonawanekiran earned 2000 total points
ID: 36955964
You have couple of ways to do this either with jquery OR from code behind page
1) Using code behind
  Write function clear_data () which will clear the values and call this function on button click
2) Jquery
      // .... clear textbox values

Author Comment

ID: 36956071
ok. if i were to do it in the code behind, i tried setting txtTextBox1 = string.empty but control retains the value.
LVL 17

Expert Comment

ID: 36956563
try like this
txtTextBox1.Text = "";

Author Comment

ID: 36956602
yes i meant txtTextBox1.Text

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question