I wonder if somebody else met the problem below with FreeTextBox like I did:
I have a FreeTextBox in my aspx page.
And the code behind to write the text in FreeTextBox (FTB) into Database:
protected void btnWrite_Click(object sender, EventArgs e)
{
if(FTB.Text!="")
{
...// insert FTB.Text into DataBase
FTB.Text="";//clear the text in FTB
}
else LabelError.Text="Write something!";
}
I got the problem when I do 3 steps:
The first time, I let the FTB
empty-> click buttonWrite-->LabelErrorshow:Write something!----> the code works fineThe 2nd time: I type:
Hello WorldinFTB--> click buttonWrite--> TheFTB.Text's contentis inserted into DataBase and theFTB.Textis cleared, then the Page Load again with emptyFreeTextBox--> the code works fine too- The 3rd time: I let the
FTBempty ---> Click button Write --> the code jump intoifcommand, TheFTB.Text's contentis inserted into DataBase, I check the Database, the new record is inserted with empty value ---> the code works wrong.
Try to debug in the 3rd option:
FTB.Text="";
I really dont know why even the FTB.Text="" , the code still jump inside if command and insert the FTB.Text="" into Database.
The important thing I want you all to know is: the code works fine in the first time (the FreeTextBox is empty), but it works wrong in the 3rd one (the FreeTextBox is empty after cleared by the 2nd one).
What wrong??? I wonder if there is some reason from my Chrome Browser,or Cache?
As recommended, I clear the Browser Cache, but I still got this problem.
Please help!!!
or