By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,548 Members | 1,735 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,548 IT Pros & Developers. It's quick & easy.

how to implement delete confirmation in datagrid

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.