473,757 Members | 10,708 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best place to cancel delete

I have a GridView with a Delete link and wondered where the best place was
to check and cancel delete of a row/record that is bound to an
SqlDatasource. I can use datasource Deleting event or GridView_RowDel eting
event. I need to get 2 values from the row I am trying to delete so I can
perform another function returns whether I can delete the record or not. I
am trying to do this in gridview event (see code below) but it is not
working. Neither string is returning a value from the 2 cells. Can anyone
point out what I am doing wrong? Thanks.

David

Sub SubfilesGridVie w_RowDeleting(B yVal sender As Object, ByVal e As
GridViewDeleteE ventArgs)

Dim strTextReturned As String
' Get the subfile of the record being deleted.

Dim row As GridViewRow = SubfilesGridVie w.Rows(e.RowInd ex)
'Set value of new Subfile text from cell

'Subfile text is contained in the 3rd column (index 2).
Dim strsubfile As String = row.Cells(2).Te xt

'Set value of SeqNo from cell

'SeqNo is contained in the 2nd column (index 1).

Dim strseqno As String = row.Cells(1).Te xt
'Run function in DBClass module to delete network subfile folder

strTextReturned = DBClass.DeleteS ubfolders(strse qno, strsubfile,
CLng(txtFileNum ber.Text))

If Left(strTextRet urned, 5) = "Error" Then

'There were files in the subdirectory or a runtime error occurred

'so cancel the delete of GridView row.

e.Cancel = True

End If

txtMsg.Text = strTextReturned

txtMsg.Visible = True

MultiView1.Acti veViewIndex = 0
End Sub
May 4 '07 #1
0 1422

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

Similar topics

1
2083
by: Chris Uwins | last post by:
Hi there, i know theres a number of ways I can achieve this but want to know the best, (but still quite simple). Up until a year ago I never used Access but have designed a few databases for work. I am working on Access 2000. I have basic SQL/VB skills - and am pretty accomplished at putting the databases together. Anyway...I've created a database to keep track of "Dayworks" we are
5
240
by: Jason MacKenzie | last post by:
Just curious about some suggested approaches to this issue (which must be common). A user goes to a page to create a new project. We have a requirement that they must see the project number before saving. We fetch the next id from a table. The issue is that users must be able to upload attachments to the project before saving but if they do that and don't ever save the project we end up with orphan records in the database and...
2
635
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I change the confirm box to say yes/no or default to cancel? ----------------------------------------------------------------------- The buttons on a confirm box cannot be changed, nor can you specify a default button. However, you should be able to change the question so that "OK" is suitable as the default. e.g. change "We will now buy ourselves...
1
2804
by: Richard | last post by:
A shipment of material is received. The shipment contains several items. Each item is assigned an internal tracking number for auditing purposes and further processed. The tracking number is mandatory, unique and non-zero, but _cannot_ be obtained or assigned automatically by Access (due to business rules ). Table A is the receive table Columns: AID, ReceiveDate, CompanyID
2
2267
by: Swinky | last post by:
I have added a delete control to my form with code in the On Click property. The delete works well, but if I cancel the delete action, the record is still deleted. Here's the code: MsgBox "Confirm delete. Once you confirm, the record will no longer exist.", vbOKCancel strSQL = "DELETE FROM TOrdAck WHERE OANo=" & Me!OANo Set dbs = CurrentDb
1
1952
by: Swinky | last post by:
I have added code to delete a record (and records in related tables) in the OnClick property: MsgBox "Confirm delete. Once you confirm, record will no longer exist.", vbOKCancel strSQL = "DELETE FROM TOrdAck WHERE OANo=" & Me!OANo Set dbs = CurrentDb dbs.Execute strSQL, dbFailOnError MsgBox dbs.RecordsAffected & " record(s) deleted"
4
2050
by: Swinky | last post by:
I have added code to delete a record (and records in related tables) in the OnClick property: MsgBox "Confirm delete. Once you confirm, record will no longer exist.", vbOKCancel strSQL = "DELETE FROM TOrdAck WHERE OANo=" & Me!OANo Set dbs = CurrentDb dbs.Execute strSQL, dbFailOnError MsgBox dbs.RecordsAffected & " record(s) deleted"
0
771
by: phanimadhav | last post by:
I am new one of this Menu's in ASP.NET.In my design page i place one MENU control.In my menu control contain items OK,DELETE,CANCEL,EDIT.And out of menu i place one gridcontrol and with checkbox by using ItemTemplate.My requirement is whenEver if i selete the checkbox and next i clicked the Delete Item in menu it will show conformationBox with buttons Ok and CANCEL.If i click the Ok that particular record is deleted from Database.If i click the...
0
2821
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation. What happened is if I select cancel on my confirmation button, it executes the griedview postback which i assigned in my code behind. Please see my codes below... Code beind: protected void gvDefectCatalog_RowDataBound(object sender,...
0
9489
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.