473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

confirmation on deletion

Hello All,
I have a delete link on my page, which when clicks calls the URL for
deletion, in ASP we use to create a java script confirm box to confirm
delete, how can that be done in ASP? Say if I use an ASP link control , or
if I use a html anchor link.

This is how I am trying to do it
<script language="javascript">

function ConfirmDelete(nChannelID)

{

if (confirm("Are you sure you want to delete this source?")

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsources.aspx?action=del&nChannelID=<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>" onclick="return
ConfirmDelete('<%# DataBinder.Eval(Container.DataItem, "nChannelID")
%>del</a>

Please suggest, thanks a lot.

Imran.
Nov 19 '05 #1
3 1548
This may not be the answer but I think you have a syntax issue:

<a href="viewsources.aspx?action=del&nChannelID=<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>" onclick="return
ConfirmDelete('<%# DataBinder.Eval(Container.DataItem, "nChannelID")
%>')>del</a> <========HERE

Clint Hill
H3O Software
http://www.h3osoftware.com
Imran Aziz wrote:
Hello All,
I have a delete link on my page, which when clicks calls the URL for
deletion, in ASP we use to create a java script confirm box to confirm
delete, how can that be done in ASP? Say if I use an ASP link control , or
if I use a html anchor link.

This is how I am trying to do it
<script language="javascript">

function ConfirmDelete(nChannelID)

{

if (confirm("Are you sure you want to delete this source?")

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsources.aspx?action=del&nChannelID=<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>" onclick="return
ConfirmDelete('<%# DataBinder.Eval(Container.DataItem, "nChannelID")
%>del</a>

Please suggest, thanks a lot.

Imran.

Nov 19 '05 #2
Thanks, that was not the issue, that was just a sample, anyway did sort out
the issue using onclick event for the anchor link.

Imran.

"Clint Hill" <cl********@nospamath3osoftware.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
This may not be the answer but I think you have a syntax issue:

<a href="viewsources.aspx?action=del&nChannelID=<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>" onclick="return
ConfirmDelete('<%# DataBinder.Eval(Container.DataItem, "nChannelID")
%>')>del</a> <========HERE

Clint Hill
H3O Software
http://www.h3osoftware.com
Imran Aziz wrote:
Hello All,
I have a delete link on my page, which when clicks calls the URL for
deletion, in ASP we use to create a java script confirm box to confirm
delete, how can that be done in ASP? Say if I use an ASP link control ,
or if I use a html anchor link.

This is how I am trying to do it
<script language="javascript">

function ConfirmDelete(nChannelID)

{

if (confirm("Are you sure you want to delete this source?")

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsources.aspx?action=del&nChannelID=<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>" onclick="return
ConfirmDelete('<%# DataBinder.Eval(Container.DataItem, "nChannelID")
%>del</a>

Please suggest, thanks a lot.

Imran.

Nov 19 '05 #3
Here's some server side code that uses javascript to display a confirmation
message.

myDeleteButton.Attributes.Add("onclick", _
"return confirm('Are you sure you want to delete?');")

In this example, the Delete button will post back only if the person
confirms they want to delete. Otherwise the server code is never called in
response to the button click.

Here's more info:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Imran Aziz" <im***@tb2.net> wrote in message
news:ud****************@TK2MSFTNGP12.phx.gbl...
Hello All,
I have a delete link on my page, which when clicks calls the URL for
deletion, in ASP we use to create a java script confirm box to confirm
delete, how can that be done in ASP? Say if I use an ASP link control , or
if I use a html anchor link.

This is how I am trying to do it
<script language="javascript">

function ConfirmDelete(nChannelID)

{

if (confirm("Are you sure you want to delete this source?")

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsources.aspx?action=del&nChannelID=<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>" onclick="return
ConfirmDelete('<%# DataBinder.Eval(Container.DataItem, "nChannelID")
%>del</a>

Please suggest, thanks a lot.

Imran.

Nov 19 '05 #4

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

Similar topics

3
by: Craig | last post by:
Hi, I'm working on a PHP FTP client, but my testers have complained the delete file link is too easy to hit by mistake. Would it be possible/plausible to write a bit of javascript that pops up a...
0
by: Ron Clarke | last post by:
I have a small web app that displays data from a SQL Server database. Using a DataGrid control on a page, the user can delete a row from the database. This works fine. But I want to prompt the user...
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...
6
by: Dave | last post by:
Hello. I want to prompt user for some action with Yes/No message, I know some tricks in JavaScript, but I need to handle the user answer at server side. Exactly I want to prompt user for...
6
by: JenHu | last post by:
Hi experts, I want to add a delete button in my datagrid, and before it deletes from database, I want to have a confirm dialog box for this deletion. I am entry level to the vb.net, and don't...
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...
0
by: ASMJ | last post by:
Hi, I have a gridview in my page, which displays all records from an sqldatasource. The delete row command is available to the user, through which he can perform deletion. I want to trap the...
1
vivek kushwaha
by: vivek kushwaha | last post by:
Hi, i have codes like this. code behind page Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles...
3
stonward
by: stonward | last post by:
Hi again Guys, I've manages to recreate some fairly cool (to me!) delete code to delete a record. However I'd like to stop the Access 'confirmation of delete' message from appearing. Is this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
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...
0
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
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...

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.