Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Adding a confirmation pop-up window for datagrid delete

Reply
Thread Tools

Adding a confirmation pop-up window for datagrid delete

 
 
Elton W
Guest
Posts: n/a
 
      05-15-2005
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



>-----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
>
><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">
> <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;
> 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"></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/)
>
><Id>oih8bs4PM0SjpdW9zA9rww==</Id>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Confirmation Message on DATAGRID Item Delete rajeshgujar@hotmail.com ASP .Net 0 06-14-2007 07:34 PM
How to use confirmation box on delete a row in a datagrid? JenHu ASP .Net 6 02-03-2005 01:31 AM
adding delete confirmation Mike Brearley ASP General 4 07-06-2004 07:28 PM
Datagrid Item Delete Confirmation not working Nedu N ASP .Net 2 12-04-2003 02:16 AM
Re: delete confirmation in datagrid sramruttun ASP .Net 0 07-04-2003 06:47 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57