Solved

ASP.NET gridview onrowdeleting

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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 …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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