Click here to Skip to main content
15,892,298 members

how to clear the textbox

csupriya asked:

Open original thread
Hi,

I am new to asp.net.and this question seems pretty silly, but I really can't figure out what is wrong.

I am having an issue with clearing the textbox.
I tried textbox.text=string.empty, textbox.text="" but none of these seem to help, the textbox just doesn't get cleared.

Can someone tell me if I have set something in the code that's not allowing me to clear the textbox?

[Edit: added code snippet from comments below - Henry]
XML
<asp:TextBox ID="TextBox3" runat="server" Width="177px" ontextchanged="TextBox3_TextChanged" Height="16px" style="margin-left: 5px"></asp:TextBox> 


C#
protected void Button11_Click(object sender, EventArgs e)
{
  Panel1.Visible = false; DropDownList5.ClearSelection();
  TextBox3.Text = string.Empty;
}

[/Edit]
Tags: ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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