 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 29th, 2004, 10:01 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Edit or Delete records
hi,
I have two tables and both are referenced. I want to perform Edit/Delete.
I am displaying all the record in table format.
checkbox rollno batchno color_code(select control) qty
The user will check the checkbox to edit/delete the corr record. Rollno, batchno, qty are textboxes. I want to assign same name to all columns(rollno to txtRollNo) for all records. When i submit the form, how can i identify which record to modify/delete coz i want to do only the checked records.
Thanx in advance
|
|

October 29th, 2004, 11:58 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You cannot do edit and delete actions in a single submit, I think. They can select some records and submit them for edit or delete but not both.
If that is the case, you can two buttons with same name(btnAction) and different values viz. Edit and Delete. When edit button is clicked, only the value "Edit" will be passed to the action page. Similarly, when delete button is pressed, only value "Delete" will be passed to action page. From the value of Request.Form("btnAction"), you can know which action (edit / delete) is required by the user.
Hope that helps
|
|

October 30th, 2004, 12:20 AM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello madhu,
You didnt catch my point. I have two button for delete and edit.
My aim is to check the checkbox and click Edit button to edit and delete button to delete.
The form is generating dynamically by retrieving from the database.
I am not sure that howmany records are there in the database.
So, i want to assing same to all controls(each field).
Ex, rollno -> txtRollNo
batchno -> txtBatchNo
If you select all checkboxes, there is no problem.
If you select random(1, 3, 4, 5) checkboxes, hown can i read particular data to edit.
When you submit the form all the data is submitted.
For rollno, 12, 23, 12, 23, 45, 45 (if there are 6 records). Coz i assigned same to rollno textboxes.
Thanx
|
|

October 30th, 2004, 12:27 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Dear simply you assign the ID value to the check boxes and submit to the next page either it is Edit or Delete page But pass the value of check box
(*_*)
Numan
--------------------------------------------------
It is not important what you get But important is how you got it
|
|

October 30th, 2004, 01:37 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
tsimsha,
You better name all those controls with some uniqueness. Say, append the corresponding Primarykey value to txtRollNo. That way you can have different names for it all. And while referencing that after submit, use the same way to pick the data update the table.
Anyways, you got to have the same name for all check boxes listed there, so that all those valules come in a comma separated string, which can be used for concatenating with the control names and thus making update possible.
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
|

October 30th, 2004, 03:07 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Numan's idea is correct. You can use the same name for the checkboxes. But give different values for each checkbox. The ID of the record is the best choice for values.
In that case, you will get values of all selected checkboxes as a comma seperated string in the action page.
If you use unique names, you need to extract the ID of the record and then combine them to form this comma seperated values. I think, we can make the system do that work if we follow Numan's idea. This list can be directly used in the delete query - delete from <table name> where <id> in <comma seperated list>
|
|

October 30th, 2004, 03:26 AM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi all,
Thank you very much. I got it from your suggesions.
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| how to EDIT,delete,add,items in my database |
zedekiah |
BOOK: Beginning ASP 3.0 |
2 |
May 15th, 2008 08:16 AM |
| How to edit/delete list items through SPGridView |
meera |
SharePoint Development |
0 |
December 7th, 2007 11:32 AM |
| save, edit, and delete |
sime_tyres |
VB Databases Basics |
1 |
September 1st, 2006 09:45 PM |
| Edit/Add/Delete within a DataGrid |
ozzy |
VB.NET 2002/2003 Basics |
5 |
January 23rd, 2005 01:17 AM |
| Edit/Delete ButtonColumn not working |
planoie |
ASP.NET 1.0 and 1.1 Professional |
9 |
August 30th, 2004 07:39 AM |
|
 |