473,396 Members | 2,052 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,396 software developers and data experts.

how to implement delete confirmation in datagrid

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 most reliable way to add delete
confirmation functionality, so that when the user clicks the Delete
button, they must take some further action before the record is
actually deleted?

Thanks in advance for any help anyone can offer.

I'm operating under the following constraints:
1. This large application was written by a consultant, who did not
document his work, and who is no longer available for modifications
or bug corrections.
2. I'm a VB veteran but a relative newcomer to C# and the Dot Net
environment, a bit overwhelmed by it, and trying to get the job done
using the most straightforward & well-documented controls and
coding techniques.
3. All of our programmers (including those with substantial C#/Dot Net
experience) have had tremendous problems debugging the Java-script
code (both embedded in the C# source and generated by some of the
consultant's proprietary routines) this application relies on, and so
we're endeavoring to minimize its use as we correct and expand the
application.
4. In the _ItemCreated method for each datagrid, there is already some
Java-script specified for the "onclick" event, and so if implementing
delete confirmation requires adding more Java-script in the same
place, it will have to co-exist with the existing Java-script.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 19 '05 #1
4 3014
Here's a good (and free) control to start with:

Confirmed Buttons Control

"This is a collection of buttons which request confirmation from the user
before posting back to the server. Included is a normal button, a link
button, and an image button. Also included are two DataGrid columns which
subclass EditCommandColumn and ButtonColumn which add confirmation to the
buttons"
http://www.metabuilders.com/Tools/ConfirmedButtons.aspx

"DrData" <as**********@pwdc-dot-org.no-spam.invalid> wrote in message
news:42**********@127.0.0.1...
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 most reliable way to add delete
confirmation functionality, so that when the user clicks the Delete
button, they must take some further action before the record is
actually deleted?

Thanks in advance for any help anyone can offer.

I'm operating under the following constraints:
1. This large application was written by a consultant, who did not
document his work, and who is no longer available for modifications
or bug corrections.
2. I'm a VB veteran but a relative newcomer to C# and the Dot Net
environment, a bit overwhelmed by it, and trying to get the job done
using the most straightforward & well-documented controls and
coding techniques.
3. All of our programmers (including those with substantial C#/Dot Net
experience) have had tremendous problems debugging the Java-script
code (both embedded in the C# source and generated by some of the
consultant's proprietary routines) this application relies on, and so
we're endeavoring to minimize its use as we correct and expand the
application.
4. In the _ItemCreated method for each datagrid, there is already some
Java-script specified for the "onclick" event, and so if implementing
delete confirmation requires adding more Java-script in the same
place, it will have to co-exist with the existing Java-script.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com


Nov 19 '05 #2
Here is an entire article written on that specific topic:
http://www.dotnetjunkies.com/HowTo/1...EB07C94A8.dcik

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"DrData" <as**********@pwdc-dot-org.no-spam.invalid> wrote in message
news:42**********@127.0.0.1...
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 most reliable way to add delete
confirmation functionality, so that when the user clicks the Delete
button, they must take some further action before the record is
actually deleted?

Thanks in advance for any help anyone can offer.

I'm operating under the following constraints:
1. This large application was written by a consultant, who did not
document his work, and who is no longer available for modifications
or bug corrections.
2. I'm a VB veteran but a relative newcomer to C# and the Dot Net
environment, a bit overwhelmed by it, and trying to get the job done
using the most straightforward & well-documented controls and
coding techniques.
3. All of our programmers (including those with substantial C#/Dot Net
experience) have had tremendous problems debugging the Java-script
code (both embedded in the C# source and generated by some of the
consultant's proprietary routines) this application relies on, and so
we're endeavoring to minimize its use as we correct and expand the
application.
4. In the _ItemCreated method for each datagrid, there is already some
Java-script specified for the "onclick" event, and so if implementing
delete confirmation requires adding more Java-script in the same
place, it will have to co-exist with the existing Java-script.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 19 '05 #3
This is how I implemented a "Confirmation" on delete inside my
datagrid

HTML:
<asp:TemplateColumn headertext="Del" headerstyle-width="20">
<ItemTemplate>
<asp:ImageButton id="Delete" alternatetext="Delete"
commandname="Delete" onload="SetDeleteButton" runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>

C#:
protected void SetDeleteButton(Object sender, EventArgs e) {
ImageButton ib = (ImageButton)sender;
//Set the graphic
SetButtonGraphics(ib, "icons/delete.gif", "", "");
//Set the javascript confirmation
ib.Attributes.Add("onclick", "return confirm('Confirm deletion of
record.');");
}

as**********@pwdc-dot-org.no-spam.invalid (DrData) wrote in message news:<42**********@127.0.0.1>...
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 most reliable way to add delete
confirmation functionality, so that when the user clicks the Delete
button, they must take some further action before the record is
actually deleted?

Thanks in advance for any help anyone can offer.

I'm operating under the following constraints:
1. This large application was written by a consultant, who did not
document his work, and who is no longer available for modifications
or bug corrections.
2. I'm a VB veteran but a relative newcomer to C# and the Dot Net
environment, a bit overwhelmed by it, and trying to get the job done
using the most straightforward & well-documented controls and
coding techniques.
3. All of our programmers (including those with substantial C#/Dot Net
experience) have had tremendous problems debugging the Java-script
code (both embedded in the C# source and generated by some of the
consultant's proprietary routines) this application relies on, and so
we're endeavoring to minimize its use as we correct and expand the
application.
4. In the _ItemCreated method for each datagrid, there is already some
Java-script specified for the "onclick" event, and so if implementing
delete confirmation requires adding more Java-script in the same
place, it will have to co-exist with the existing Java-script.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 19 '05 #4
Well nice approach normally call it on ItemDataBound!

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #5

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

Similar topics

4
by: Mike Brearley | last post by:
How would I add a delete confirmation popup box for the following? Here's what I have... A table (not a form) that contains this line: <td align="center"><a...
3
by: Asif Rahman | last post by:
Hi all! Please improve on the following code to make sure the record gets deleted only when the function returns false. Now I see the msgbox, but the record gets deleted no matter the user...
0
by: Bas V. | last post by:
I am using Visual Studio Express 2005 beta 1, C#. I use the UserDeletingRow event to show a confirmation messagebox when a user tries to delete a record from a DataGrid. When the user presses the...
4
by: Nedu N | last post by:
Hi Experts, All of sudden the delete confirmation is not working for me on my datagrid (it was working 2 days ago..couldn't figure out the cause). I am trying to add an 'onsubmit' attribute to...
3
by: Dave | last post by:
How can I add the confirmation dialog on record delete to the "Delete" command column in DataGrid control?
0
by: debnath1981 | last post by:
Insert, Update, Delete through DataGrid
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...
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...
1
by: AJMAL YAZDANI | last post by:
Hello All, In my GridView, I am using "BoundFiled" for "Delete" functionality instead of "ItemTemplate". Now, I want a "Delete Confirmation" with Javascript. What I have to do. Regards,
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...

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.