473,472 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Confirmation of delete

Hi,

Can't seem to find the answer to this on any posts.

I want the javascript confirmation of delete to occur on my datalist for
the 'delete' linkbutton. The code below works fine for the delete, but
it somehow gets fired off when 'edit' linkbutton is clicked on. Which i
don't understand.
I have the following code:

Private Sub dlstAddress_ItemCreated(ByVal s As Object, ByVal e As
DataListItemEventArgs) Handles dlstAddress.ItemCreated

If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <>
ListItemType.Footer Then

Dim linkDelete As LinkButton =
CType(e.Item.FindControl("LinkDelete"), LinkButton)

linkDelete.Attributes.Add("onclick", "return confirm('Are
you sure you want to delete selected item?');")
End If

End Sub
Thanks in advance
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
1 878
view source and check if the onclick attribute is also added for Edit link.
i think it could happen if you have named Edit link as LinkDelete..otherwise
i cant think of any other err..

Av.
http://dotnetjunkies.com/WebLog/avnrao
http://www28.brinkster.com/avdotnet

"Angela" <an**@email.com> wrote in message
news:ut**************@TK2MSFTNGP09.phx.gbl...
Hi,

Can't seem to find the answer to this on any posts.

I want the javascript confirmation of delete to occur on my datalist for
the 'delete' linkbutton. The code below works fine for the delete, but
it somehow gets fired off when 'edit' linkbutton is clicked on. Which i
don't understand.
I have the following code:

Private Sub dlstAddress_ItemCreated(ByVal s As Object, ByVal e As
DataListItemEventArgs) Handles dlstAddress.ItemCreated

If e.Item.ItemType <> ListItemType.Header And e.Item.ItemType <>
ListItemType.Footer Then

Dim linkDelete As LinkButton =
CType(e.Item.FindControl("LinkDelete"), LinkButton)

linkDelete.Attributes.Add("onclick", "return confirm('Are
you sure you want to delete selected item?');")
End If

End Sub
Thanks in advance
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 18 '05 #2

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

Similar topics

3
by: Dennis Allen | last post by:
Hi. On my online ordering form I use browser cookies to keep track of user items. My confirmation page reads: "If any of this information is incorrect, please go back to the order form and...
6
by: Dotnet Guy | last post by:
I want to add a confirmation dialog box before I delete the records in my form. I have a piece of javascript code in html that checks for confirmation. But the main issue lies in calling this...
1
by: Grey | last post by:
I can used the RegisterOnSubmitStatement to set the confirmation alert box, i.e. RegisterOnSubmitStatement("submit", "return confirm('Delete Page?');"). But this confirmation box prompted out from...
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
4
by: DrData | last post by:
I'm working on an ASP.Net application written in C#. On one page, there are several datagrid controls used to display, edit and delete detail records relating to the master record also displayed on...
1
by: Amelyan | last post by:
What is the common way in ASP.NET C# to pop up a confirmation dialog box? E.g. Are you sure you want to delete this item? Yes No
0
by: Elton W | last post by:
Hi Peter, You use DeleteButton.Attributes.Add("onclick", "return confirm ('Are you sure you want to delete?');"); in datagrid_ItemDataBound event to add confirmation for delete button.
0
by: Suzanne | last post by:
I'd like to know how can I put up a confirmation question when the user tries to delete a row in the datagrid by clicking on the row header and pressing the Delete key? I have found this code on...
0
by: johnmott | last post by:
Hi all, One of the limitations of the GridView control is that the built-in delete processing doesn't prompt for confirmation -- something thats very important for a user interface. True, you...
4
by: ITCraze | last post by:
Hello everyone, I have a Gridview , whose first column is template colums which contains checkboxes , outside my GridView I a have a delete button. So in this application,when the user check...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.