🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.aspdotnet.general
Article #63

Sample code: Add delete confirmation to a GridView Control.

#63
From: johnmott
Date: Wed, 12 Sep 2007 15:51
20 lines
2051 bytes
Hi all,

One of the limitations of the GridView control is that the built-in 
delete processing doesn't prompt for confirmation -- something thats 
very important for a user interface. True, you can add server side 
logic for this, but its much more reassuring to have a Javascript 
confirmation window open up and prompt. There are several techniques 
for doing this, just google 'Gridview delete confirm' to see them. 
I've figured out one which does not involve adding logic to the GridView 
setup, so there are fewer moving parts. And, it still preserves the ViewState.
There is a small amount of C# code to perform the actual record delete, but 
this is mostly a client-side/Javascript technique. 

The sample application with source is available at 

App: http://www.nicecleanexample.com/ViewApp.aspx?TID=gridviewconfirmdel

Hope it helps.

John
Technical Details
Message-ID: <RLWdnbB_MNKVlnXbnZ2dnUVZ_qvinZ2d@comcast.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 124d48,b5cc1dc2e6bfb145,start
X-Google-Attributes: gid124d48,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 12 Sep 2007 10:51:36 -0500
From: johnmott<%=58+1%>@hotmail.com
Newsgroups: borland.public.csharpbuilder.aspdotnet.general
Subject: Sample code: Add delete confirmation to a GridView Control.
Message-ID: <RLWdnbB_MNKVlnXbnZ2dnUVZ_qvinZ2d@comcast.com>
Date: Wed, 12 Sep 2007 10:51:36 -0500
Lines: 21
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 68.32.106.189
X-Trace: sv3-t1LR7NDeWF6r/zP73Id6KrFzVN50Bc2e3TixyFiJ5Dif2HOHhLO/Ir/B/MBzyo6cWvezpeZBqBU8qGA!r6UeVgI2cZ1wNPUTdTDkEvGOuPF/rpfyMhmOvlKA6Lm4aCXPzgaJenc3kVkUXdfbUY/WOGpU+Let!mSkZmy1KmLWg3t7JInyTPmmEYpUfbA==
X-Complaints-To: abuse@comcast.net
X-DMCA-Complaints-To: dmca@comcast.net
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.35