Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > detailsView DeleteCommand

Reply
Thread Tools

detailsView DeleteCommand

 
 
savvas.ioannides@gmail.com
Guest
Posts: n/a
 
      04-28-2006
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.DetailsViewCommandEventA rgs) 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

 
Reply With Quote
 
 
 
 
clickon
Guest
Posts: n/a
 
      04-28-2006
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.

"(E-Mail Removed)" 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.DetailsViewCommandEventA rgs) 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
>
>

 
Reply With Quote
 
 
 
 
savvas.ioannides@gmail.com
Guest
Posts: n/a
 
      05-02-2006
Hi,

Thanks for answering. It worked out fine.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add the DeleteCommand in aspx.vb file? ASP .Net 0 05-24-2006 02:00 PM
DataList.DeleteCommand event is not getting fired Nathan Sokalski ASP .Net 4 05-21-2006 05:17 PM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM
When I click the cancel button of the DataGrid control, it raises DeleteCommand event!!! Why???????? XueWu ASP .Net 0 07-12-2005 01:42 PM
ItemDataBound doesn't fire when I use DeleteCommand Peter Afonin ASP .Net 2 11-19-2003 05:26 PM



Advertisments