Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / April 2008

Tip: Looking for answers? Try searching our database.

How to delete multiple rows in a GridView?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael - 29 Apr 2008 04:01 GMT
It seems that a gridview allows us to delete only a single row at a time.
How to extend this functionality to select multiple rows and delete all of
the selected rows in a single stroke? just like what hotmail web UI is doing
now (having the option of selecting multiple rows (using the checkbox
provided) and perform a set of operations on them)
Steven Cheng [MSFT] - 29 Apr 2008 06:21 GMT
Hi Michael,

As for ASP.NET GridView control, the one-row based editing/updating is due
to its postback event processing mode. In that built-in postback processing
model, the edit/update/delete will only focus on a single row.  

If you want to implement a multiple row based editing/deleting, you need to
use the default readonly mode and provide your own multi-row select
interface. For example, you can put an additional column in Gridview row
which contains a checkbox, and put an "delete" button in the GridView's
header or footer. In the postback event, you can manually loop through all
the GridViewRow to lookup the checkbox value in each row and determine
whether to perform deleting for the certain row.

Here are tow web articles that provide examples of add multi-row processing
in ASP.NET Gridview:

#Deleting Multiple Rows in a GridView
http://www.dotnetcurry.com/ShowArticle.aspx?ID=66&AspxAutoDetectCookieSuppor
t=1

#Allowing Users to Delete Rows in a GridView Control
http://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstode
leterowsingridview.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>Reply-To: "Michael" <Michael_MSDN@noemail.noemail>
>From: "Michael" <Michael_MSDN@noemail.noemail>
[quoted text clipped - 6 lines]
>now (having the option of selecting multiple rows (using the checkbox
>provided) and perform a set of operations on them)
Michael - 30 Apr 2008 06:19 GMT
Thanks for the reply. It helps.

> Hi Michael,
>
[quoted text clipped - 70 lines]
>>now (having the option of selecting multiple rows (using the checkbox
>>provided) and perform a set of operations on them)

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.