|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
detailsView DeleteCommandIm not really experienced with web applications. I am using vb.net 2005. I have a gridview where, when i press the select button, the information is shown in detailsView. I chose that because gridview does not support delete capabilities. Everything works fine :). What I need is simple really. I want to confirm the delete command in detailsView before it is triggered. I tried the following code: Protected Sub dvCountries_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles dvCountries.ItemCommand Select Case e.CommandName Case "Edit" Case "Delete" 'modValidations.confirmDelete(Me) is a boolean function which returns true if the response of 'the msgbox is true. If modValidations.confirmDelete(Me) = True Then ' I don't know what code to put here Else 'nothing End If Case Else ' Do nothing. End Select End Sub How can I prevent deletion of the record? Any help would be appreciated. Thanks Savvas If you want to cancel you can use the ItemDeleting event and set the e.Cancel
property to true. Obviously you will need to be able to check for some condition within the ItemDeleting event to determine whether or not to cancel the delete. Show quoteHide quote "savvas.ioanni***@gmail.com" wrote: > Hi, > > Im not really experienced with web applications. I am using vb.net > 2005. I have a gridview where, when i press the select button, the > information is shown in detailsView. I chose that because gridview does > not support delete capabilities. Everything works fine :). > > What I need is simple really. I want to confirm the delete command in > detailsView before it is triggered. > > I tried the following code: > > Protected Sub dvCountries_ItemCommand(ByVal sender As Object, ByVal e > As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles > dvCountries.ItemCommand > > Select Case e.CommandName > > Case "Edit" > > Case "Delete" > > 'modValidations.confirmDelete(Me) is a boolean function which returns > true if the response of > 'the msgbox is true. > > If modValidations.confirmDelete(Me) = True Then > ' I don't know what code to put here > Else > 'nothing > End If > Case Else > ' Do nothing. > End Select > End Sub > > How can I prevent deletion of the record? Any help would be > appreciated. > > Thanks > > Savvas > >
System.Web.HttpException FindContol exception
framed Open htm and asp pagen inside an .NET aspx project Deriving from built-in DataGrid control asp.net 2.0 webparts Custom Server Control Design Best Practices? Setting control focus on roundtrip How to Display an image, from a DB, into the Gridview (ASP.NET 2.0) Welcome to Gridview Hell Webpartzone as DIV |
|||||||||||||||||||||||