Adding a confirmation pop-up window for datagrid delete

E

Elton W

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.

HTH

Elton Wang
(e-mail address removed)

-----Original Message-----
(Type your message here)
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
<HTML>
<HEAD>
<title>ViewBooking</title>
<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">
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;
else
return false;
}

</script>
</HEAD>
<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"> said:
<ItemStyle
ForeColor="Black"> said:
<HeaderStyle Font-
Size="10pt" Font-Names="Arial" Font-Bold="True"
ForeColor="White" BackColor="#A2C1FF"> said:
<Columns>
<asp:EditCommandColumn ButtonType="PushButton"
UpdateText="Update" CancelText="Cancel"
EditText="Edit"> said:
<asp:BoundColumn
DataField="Cust_Email" ReadOnly="True"
HeaderText="Customer Email"> said:
<asp:BoundColumn
DataField="Booking_Date" ReadOnly="True"
HeaderText="Booking Date"> said:
<asp:BoundColumn
DataField="Booking_Time" ReadOnly="True"
HeaderText="Booking Time"> said:
<asp:BoundColumn
DataField="Service_Type" ReadOnly="True"
HeaderText="Service Type"> said:
<asp:BoundColumn
DataField="Reported_fault" ReadOnly="True"
HeaderText="Reported Fault"> said:
<asp:BoundColumn
DataField="Model_Name" ReadOnly="True" HeaderText="Model
Name"> said:
<asp:BoundColumn
DataField="Model_No" ReadOnly="True" HeaderText="Model
No"> said:
<asp:BoundColumn
DataField="Sales_ID" ReadOnly="True" HeaderText="Receipt
No"> said:
#Container.DataItem("Status")%>
<asp:TextBox Id ="TxtStatus" Runat ="server" TexT
<asp:RequiredFieldValidator ID="rfvStatus"
Display="Dynamic" ErrorMessage="Status is required!"
Controltovalidate="TxtStatus"
Runat="server" />
<asp:ButtonColumn
Text="Delete" ButtonType="PushButton"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top