Solved

ASP.NET gridview onrowdeleting

Posted on 2012-04-09
2
264 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
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
comparing string in C# 3 33
ConsoleSql 1 18
C# Error - Add Failed 12 49
Handle null when using linq in this line 1 20
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now