473,321 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

delete text in a textbox

Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in our database, if they exist then the product name is returned and the product number is then replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and enter in new ones and click the button. When this happens the old product names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox, and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets product name, Then the user deletes everything in the textbox and enters in new product ID's and clicks enter. In this case I only need to show the new products entered and not the old products and new products.
how can this be done?
I'm using a asp:textbox on the server, validating on the server
Aug 23 '07 #1
3 2583
RSH
mike,

i would say you could implement some javascript client side that would fire onchange in the appropriate textbox. You could store the previous text in a variable and perform conditionals in the onchange event handler. I use this type of procedure often, in some cases enabling and disabling ctontrols as well as clearing and repopulating controls as needed. Powerful UI stuff for sure.

HTH,
Ron

"Mike" <Mi**@community.nospam.comwrote in message news:et**************@TK2MSFTNGP04.phx.gbl...
Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in our database, if they exist then the product name is returned and the product number is then replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and enter in new ones and click the button. When this happens the old product names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox, and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets product name, Then the user deletes everything in the textbox and enters in new product ID's and clicks enter. In this case I only need to show the new products entered and not the old products and new products.
how can this be done?
I'm using a asp:textbox on the server, validating on the server
Aug 23 '07 #2
Not sure to understand the exact problem but I believe it could be simpler not to use the input textbox to display the output. This way on each postback you have just to display somewhere else the productnames for the IDs that are currently in the *input IDs* textbox.

For now it looks like to me that you record those productname somewhere server side as each id is added and that you never clear this list ???

---
Patrice
"Mike" <Mi**@community.nospam.coma écrit dans le message de news: et**************@TK2MSFTNGP04.phx.gbl...
Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a button to see if the product numbers(s) exists in our database, if they exist then the product name is returned and the product number is then replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and enter in new ones and click the button. When this happens the old product names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox, and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets product name, Then the user deletes everything in the textbox and enters in new product ID's and clicks enter. In this case I only need to show the new products entered and not the old products and new products.
how can this be done?
I'm using a asp:textbox on the server, validating on the server
Aug 23 '07 #3
Where's your variable? I mean... is it part of the Page?
Not quite sure if I have really understood your model... but have you looked
into ViewState?

--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
"Mike" <Mi**@community.nospam.comwrote in message
news:et**************@TK2MSFTNGP04.phx.gbl...
Is there a way to determine if a user deleted text in a asp:textbox?

I have a textbox were users can enter in a product number, then they click a
button to see if the product numbers(s) exists in our database, if they
exist then the product name is returned and the product number is then
replaced by the product name in the textbox.

The user can then, delete a product or all product names in the textbox and
enter in new ones and click the button. When this happens the old product
names in the textbox are still appearing even though the use deleted them.

Currently I'm storing the product ID and product name in a variable to keep
adding products if need be and to pass them to my save function.

So is there a way to determine if the user deletes the text in the textbox,
and if the text in the textbox matches my data in the variable?

Example: here is a few scenarios that can happen

1) a user enters in a product ID (dt1234) clicks enter - if t1234 exists in
the database, the textbox then shows - Dumptruck 1/24
2) the user enters in product ID's (dt1234, t456,ft557) clicks add and if
they exist the textbox shows (Dumptruck 1/24, trailer 1/24, Firetruck 1/24)
3) the user enters in product ID's (dt1234, t456,ft557) clicks enter, gets
product name, Then the user deletes everything in the textbox and enters in
new product ID's and clicks enter. In this case I only need to show the new
products entered and not the old products and new products.
how can this be done?
I'm using a asp:textbox on the server, validating on the server
Aug 25 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Rich | last post by:
Hello, I have an oleDBDataAdapter (da1) which gets data from an Access mdb and fills a dataset (ds1) with integer data from "tbl1" in Access. Data displays in textboxes on a form. The...
3
by: Robert W. | last post by:
In my WinForms app I wanted to implement a Read-Only textbox. I didn't like the appearance a textbox takes on when the ReadOnly property is set true so instead I trapped the KeyPress event with a...
6
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called...
6
by: Joemanc | last post by:
I've converted my VB6 app to VB.NET 2003. For some strange reason, the delete key will not work in any of my textboxes in the application. The backspace key works just fine. The delete key works in...
5
by: Steve | last post by:
I have created my own context menu. Everything works except undo'ing deleted text. My code for these two events are: Private Sub tsmiUndo_Click(ByVal sender As Object, ByVal e As...
3
by: pargat.singh | last post by:
I want to add delete button to grid view and pass all the clicked row parameters. Can someone please tell me how can i do this? Below are my codes. Thanks in advance. <asp:GridView...
2
by: cmrhema | last post by:
hello, i am new to asp.net. i am trying to do a simple application of adding,inserting and deleting rows in gridview. i am using C#.net and javascript. My edit/update works but i have...
5
by: sh26 | last post by:
I can Add and Delete (A, CName, MX and TXT) Dns records on the Dns Server using C# code. The problem I am having is if someone manaully creates a TXT record on the Dns Server, I cannot delete that...
2
by: Danielle | last post by:
Hello all - Thank you in advance for any help you are able to provide. I am populating a gridview from a stored procuedure. The returned data is a name, phone number, email and guid of a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.