11 Answers, 1 is accepted
0
Accepted
Hi Travis,
Vlad
the Telerik team
You can use Deleting event to achieve this. Here is an example:
private void RadGridView_Deleting(object sender, Telerik.Windows.Controls.GridViewDeletingEventArgs e)
{
var result = MessageBox.Show("Test", "Test", MessageBoxButton.OKCancel);
e.Cancel = (result == MessageBoxResult.Cancel);
}
Sincerely yours,Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Travis
Top achievements
Rank 1
answered on 02 Sep 2010, 07:14 PM
The deleting event handler is not fired when the "Delete" key is pressed. The ItemsSource of the GridView is using RIA. I don't know if that makes a difference or not.
0
Hello,
Vlad
the Telerik team
How the grid is bound in your case? If you use DomainDataSource everything should work as expected.
Sincerely yours,Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
lee_bnsf
Top achievements
Rank 1
answered on 03 Sep 2010, 02:03 PM
I'm have a similar situation. Is there a way to get the grid to respond to the delete key without being bound to a DomainDatasource; or in my case bound to a read-only entity in a DomainDatasource?
Thanks,
Lee
Thanks,
Lee
0
Hello,
Vlad
the Telerik team
If the grid is not bound at least to IList you will unable to add and remove items and that is why the event will not be raised.
Kind regards,Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
lee_bnsf
Top achievements
Rank 1
answered on 03 Sep 2010, 02:23 PM
Thanks Vlad. As soon as I posted this I saw that my grid did not the CanUserDeleteRows property set to true. When I updated that everything worked as expected. Rookie mistake. :(
Thanks,
Lee
Thanks,
Lee
0
Travis
Top achievements
Rank 1
answered on 07 Sep 2010, 04:03 PM
It is working now. Not sure what I was doing wrong the first time.
0
Marc Roussel
Top achievements
Rank 2
answered on 26 Apr 2013, 11:28 PM
I feel lucky this time.
What if I'm in the Deleting Event and even before asking the user to confirm, the line is already deleted from the UI because I hit Delete from the keyboard on a line
When I say NO and I code e.Cancel = true, it doesn't any good.
I'm using version 2013.1.403.1050
Here's the code :
private
void
rgvExpenses_Deleting(
object
sender, GridViewDeletingEventArgs e)
{
// Huh ? The line is already deleted from the UI. I can see it while the confirmation is on screen
RadWindow.Confirm(
"Are you sure ?"
, (s, ee) =>
{
if
(ee.DialogResult.Value)
e.Cancel =
false
;
// I suppose this means don't cancel the delete because I said YES which the ee.DialogResult means I've pressed YES
else
e.Cancel =
true
;
// I suppose this should cancel the delete but he huh the delete was already performed. What am I missing ?
});
}
0
Marc Roussel
Top achievements
Rank 2
answered on 26 Apr 2013, 11:31 PM
I found this thread : http://www.telerik.com/community/forums/silverlight/gridview/delete-confirmation-using-radwindow-confirm.aspx
Going to read the article then !
Going to read the article then !
0
Marc Roussel
Top achievements
Rank 2
answered on 26 Apr 2013, 11:41 PM
After reading the article, I don't know why but I feel like there's a problem somehow.
How it comes to be called DELETING and yet the line is deleted even before I'm asking a confirmation in the Deleting event ?
It bugs me.
How it comes to be called DELETING and yet the line is deleted even before I'm asking a confirmation in the Deleting event ?
It bugs me.
0
Marc Roussel
Top achievements
Rank 2
answered on 27 Apr 2013, 12:02 AM
I think I get it. Here's my version. Don't forget to add a reference to System.Windows.Data
private
void
rgvExpenses_Deleting(
object
sender, Telerik.Windows.Controls.GridViewDeletingEventArgs e)
{
e.Cancel =
true
;
RadWindow.Confirm(
"Certain ?"
, (s, ee) =>
{
if
(ee.DialogResult.Value)
{
foreach
(var Expense
in
e.Items)
rgvExpenses.Items.Remove(Expense);
e.Cancel =
false
;
}
});
}