Solved

ASP.NET gridview onrowdeleting

Posted on 2012-04-09
2
269 Views
Last Modified: 2012-04-13
I have code inside of a Onrowdeleting method, and this code correctly checks a condition to see if I want to delete the selected row.  My question is how do I tell the GridView and/or the DataSource to NOT execute the delete statement if a condition is met?
0
Comment
Question by:zintech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:zintech
ID: 37823752
What I decided to do now was Delete the records to be deleted through code.  But now, I am receiving an error that the DeleteComman was not set on the DataSource.  How do I get the DeleteCommand to not fire when the user click the "Delete" link?
0
 
LVL 12

Accepted Solution

by:
CmdoProg2 earned 500 total points
ID: 37827705
in the rowdeletingcommand, set the cancel command to true which will not fire the DeleteCommand.

 protected void grdProjects_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
  // Place deleting code here
  e.Cancel = true;
 }

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question