473,778 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="javas cript">

function ConfirmDelete(n ChannelID)

{

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

{

return true;

}

else

{

return false;

}
}

</script>

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

Please suggest, thanks a lot.

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

<a href="viewsourc es.aspx?action= del&nChannelID= <%#
DataBinder.Eval (Container.Data Item, "nChannelID ") %>" onclick="return
ConfirmDelete(' <%# DataBinder.Eval (Container.Data Item, "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="javas cript">

function ConfirmDelete(n ChannelID)

{

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

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsourc es.aspx?action= del&nChannelID= <%#
DataBinder.Eval (Container.Data Item, "nChannelID ") %>" onclick="return
ConfirmDelete(' <%# DataBinder.Eval (Container.Data Item, "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********@nos pamath3osoftwar e.com> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...
This may not be the answer but I think you have a syntax issue:

<a href="viewsourc es.aspx?action= del&nChannelID= <%#
DataBinder.Eval (Container.Data Item, "nChannelID ") %>" onclick="return
ConfirmDelete(' <%# DataBinder.Eval (Container.Data Item, "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="javas cript">

function ConfirmDelete(n ChannelID)

{

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

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsourc es.aspx?action= del&nChannelID= <%#
DataBinder.Eval (Container.Data Item, "nChannelID ") %>" onclick="return
ConfirmDelete(' <%# DataBinder.Eval (Container.Data Item, "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.ne t> wrote in message
news:ud******** ********@TK2MSF TNGP12.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="javas cript">

function ConfirmDelete(n ChannelID)

{

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

{

return true;

}

else

{

return false;

}
}

</script>

<a href="viewsourc es.aspx?action= del&nChannelID= <%#
DataBinder.Eval (Container.Data Item, "nChannelID ") %>" onclick="return
ConfirmDelete(' <%# DataBinder.Eval (Container.Data Item, "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
24183
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 confirmation when they click the link, that goes to a certain page if they click yes and does nothing if they click no? I have no idea if this is tough or not. Any help with this would be greatly appreciated.
0
446
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 for confirmation ("Are you sure...") before deleting the record. How can I do this from the ASP.NET code? Since the C# code is server-side, is there a way to display a Yes/No type of message box and only take action if the users clicks the "Yes"...
1
3399
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 two command buttons as I have two command buttons in the form, delete command and print command. How can I set just allow the delete command to prompted confirmation alert box. Moreover, How can I trigger the delete command after the user choose yes...
6
3417
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 confirmation on delete action of some data in my application. How can I do this?
6
4638
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 know java or c#. The problem is, when I tested the program, there is no pop-up confirmation box for the deletion, can you show me what' wrong with this code? Thank you.
4
3033
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 that page. Each row in each datagrid includes a Delete button (added at runtime by the code-behind page as a ButtonColumn) and an Edit button (added at runtime by the code-behind page as an EditCommandColumn). What is the quickest, easiest and...
0
1372
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 gridview_RowDeleting event to display a confirmation msg to the user. Is there a msgbox kind of facility where I can get confirmation from the user before deletion?
1
1168
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 DataGrid1.ItemCommand If e.CommandName = "changestatus" Then clsMaster.ExecuteQry("update CaseMaster set Cancel = 'N', CanceledBy = '', CancelReason='', Reason1='', Notes='' where caseid=" & e.Item.Cells(1).Text & "") ...
3
1989
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 possible? Good to talk with y'all again. StonwardR
0
9470
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10127
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8957
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...
1
7475
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
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
5370
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
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2865
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.