?
Solved

ASP.NET gridview onrowdeleting

Posted on 2012-04-09
2
Medium Priority
?
272 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

801 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