473,503 Members | 756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding a confirm delete pop-up for a button field

How do you add a confirm delete pop-up for a button field? I've managed
to do this for a link button, where you can refer to the button id, but
there is no id to refer to for a button field. Here's my code :

<asp:ButtonField ButtonType="Image" ImageUrl="~/Images/btnDelete.jpg"
CommandName="Delete" />
and my code for the delete so far :

protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)

{

if (e.CommandName == "Delete")

{

//// 1)Convert the row index stored in the CommandArgument property to
an Integer

int index = Convert.ToInt32(e.CommandArgument);

//// Retrieve the row that contains the button clicked by the user from
the Rows collection

GridViewRow row = GridView1.Rows[index];

////get datakeys

int intID = (int)GridView1.DataKeys[row.DataItemIndex].Value;

}

Thanks,

Mike

*** Sent via Developersdex http://www.developersdex.com ***
Aug 2 '06 #1
1 4015
This might help -
http://gridviewguy.com/ArticleDetail...?articleID=138. Other
articles on that site as well.

Aug 2 '06 #2

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

Similar topics

2
10105
by: neoconwannabe | last post by:
Hi, I have an html form with a number of checkboxes that can be checked to delete items. I want to have a javascript alert prompt box to pop up to confirm the delete. I am building my site with...
7
2006
by: TJS | last post by:
javascript "confirm" fires after deletion instead of before deletion. how do I get this to stop the processing ? code ================== Sub ShowAlert(ByVal s As string)...
9
424
by: Greg | last post by:
Binding Manager & dataset - won't add record I've got an untyped dataset with controls bound through code. The user can select a question number from a bound combobox, and the question number and...
4
10013
by: tfsmag | last post by:
Okay, I have a project management app i'm writing and in the left hand menu i have a treeview control that is populated with each project... in child nodes under each project node I have an "edit"...
8
14625
by: Eric | last post by:
I have a confirm alert before the user goes to a delete page, and it doesn't matter if the user clicks ok or cancel - they always go to the delete page. I have the following code: <a...
0
989
by: rajeshgujar | last post by:
Here is What needs to be Done In Your DataGrid do this 1 ] Private Sub DGReference_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles...
14
18211
by: darrel | last post by:
Is it possible to pre-empt the javascript function used to do a postback from a linkbutton? I'd like to use linkbutton to delete a record and want to add a confirmation box via javascript "are...
5
2506
by: paitoon | last post by:
I have a DHTML confirm box that i will use to confirm delete the information from my page which are from database.... this is the script </script> <script type="text/javascript"> function...
2
19129
by: dddan | last post by:
Here's my code: <asp:LinkButton OnClick="DeleteFile" OnClientClick="if (!confirm ('Are you certain you want to delete this file?') ) return false;" runat="server" ID="DeleteButton">DELETE...
2
779
by: RN1 | last post by:
I have a DataList which displays the first & last name of users as links (LinkButtons). When the links are clicked, 2 textboxes appear - one with the first name & the other with the last name - for...
0
7203
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
7089
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
7282
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
7463
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...
1
5017
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
4678
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
3168
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
1515
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 ...
0
389
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...

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.