468,785 Members | 1,674 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,785 developers. It's quick & easy.

Adding a confirmation pop-up window for datagrid delete

Hi Peter,

You use

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

in datagrid_ItemDataBound event to add confirmation for
delete button.


Elton Wang

-----Original Message-----
(Type your message here)

From: Peter Rio

Iam trying add pop up window for delete but i am having problem with it..i am using data grid with push button for
the delete function plus am using java script on the
client side(HTMT) but dont really know how to make the pop
up work when the delete button is cliked..here is a html
code..Anyhelp would be really appreciated.thanks
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR"> <meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE"> <meta content="JavaScript" name="vs_defaultClientScript"> <meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema"> <script language="javascript">
function confirm_delete()
if (confirm("Are you sure you want to delete this item?")==true) return true;
return false;

<body bgColor="#ffffff" MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server">
<asp:datagrid id="ViewBookingGrid" style="Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP:
104px" BorderStyle="Solid" BorderColor="Gray" Runat="Server"
AutoGenerateColumns="False" CellPadding="1" OnDeleteCommand="dg_Delete" Height="216px" Font-
Size="X-Small" OnEditCommand="dg_Edit"
OnUpdateCommand="dg_Update" onCancelCommand="dg_Cancel" Font-Names="Arial"
Width="712px" DataKeyField="Booking_ID"> <AlternatingItemStyle Font- Names="Arial" BackColor="#CCCCCC"></AlternatingItemStyle> <ItemStyle ForeColor="Black"></ItemStyle> <HeaderStyle Font- Size="10pt" Font-Names="Arial" Font-Bold="True"
ForeColor="White" BackColor="#A2C1FF"></HeaderStyle> <Columns>
<asp:EditCommandColumn ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel"
EditText="Edit"></asp:EditCommandColumn> <asp:BoundColumn DataField="Cust_Email" ReadOnly="True"
HeaderText="Customer Email"></asp:BoundColumn> <asp:BoundColumn DataField="Booking_Date" ReadOnly="True"
HeaderText="Booking Date"></asp:BoundColumn> <asp:BoundColumn DataField="Booking_Time" ReadOnly="True"
HeaderText="Booking Time"></asp:BoundColumn> <asp:BoundColumn DataField="Service_Type" ReadOnly="True"
HeaderText="Service Type"></asp:BoundColumn> <asp:BoundColumn DataField="Reported_fault" ReadOnly="True"
HeaderText="Reported Fault"></asp:BoundColumn> <asp:BoundColumn DataField="Model_Name" ReadOnly="True" HeaderText="Model
Name"></asp:BoundColumn> <asp:BoundColumn DataField="Model_No" ReadOnly="True" HeaderText="Model
No"></asp:BoundColumn> <asp:BoundColumn DataField="Sales_ID" ReadOnly="True" HeaderText="Receipt
No"></asp:BoundColumn> <asp:TemplateColumn> <HeaderTemplate> Status </HeaderTemplate> <ItemTemplate> <% #Container.DataItem("Status")%> </ItemTemplate> <EditItemTemplate> <asp:TextBox Id ="TxtStatus" Runat ="server" TexT
='<%#Container.DataItem("Status")%>'/> <asp:RequiredFieldValidator ID="rfvStatus"
Display="Dynamic" ErrorMessage="Status is required!"
Controltovalidate="TxtStatus" Runat="server" /> </EditItemTemplate> </asp:TemplateColumn> <asp:ButtonColumn Text="Delete" ButtonType="PushButton"
CommandName="Delete"></asp:ButtonColumn> </Columns>

Posted by a user from .NET 247 (http://www.dotnet247.com/)


Nov 19 '05 #1
0 2526

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Martin Herrman | last post: by
9 posts views Thread by Marek Mänd | last post: by
7 posts views Thread by Andy | last post: by
reply views Thread by angus | last post: by
2 posts views Thread by scout3014 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.