ASP.NET gridview onrowdeleting

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?
Who is Participating?
CmdoProg2Connect With a Mentor Commented:
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

zintechAuthor Commented:
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.