This is a migrated thread and some comments may be shown as answers.

Delete Confirmation using RadWindow.Confirm().

9 Answers 491 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Yonghan
Top achievements
Rank 1
Yonghan asked on 09 Jan 2011, 07:20 AM
Hi,

I can't handle delete confirmation using RadWindow.Confirm().
I think RadWindow.Confirm() is not truly modal.

I added the delete button column as follows:
<t:GridViewColumn>
  <t:GridViewColumn.CellTemplate>
    <DataTemplate>
      <t:RadButton Command="t:RadGridViewCommands.Delete" CommandParameter="{Binding}">
        <t:RadButton.Content>
          <Image Source="{StaticResource DelImageSource}" Width="16" Height="16"/>
        </t:RadButton.Content>
      </t:RadButton>
    </DataTemplate>
  </t:GridViewColumn.CellTemplate>
</t:GridViewColumn>

and I wait user confirmation at Deleting event handler like this:
private void selectionGrid_Deleting(object sender, GridViewDeletingEventArgs e)
{
  RadWindow.Confirm(ApplicationStrings.DeleteConfirmMessage, (s1, e1) =>
  {
    e.Cancel = (a.DialogResult.HasValue && !a.DialogResult.Value);
  });
}

but it's not work!
when confirm windows is poped up, the row was already deleted. so e.Cancel = true is useless.


but MessageBox.Show() is working.

private void dataGrid_Deleting(object sender, GridViewDeletingEventArgs e)
{
  var result = MessageBox.Show(ApplicationStrings.DeleteConfirmMessage, "Confirmation", MessageBoxButton.OKCancel);
  e.Cancel = (result == MessageBoxResult.Cancel);
}

9 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 10 Jan 2011, 02:41 PM
Hi Yonghan,

In our online documentation is shown the recommended way to synchronize the RadGridView's Deleting event with RadWindow. Please take a look at the following article "Delete" and let me know how this works for you. In addition to this you may send us a small application via support ticket where we can see what is wrong in your code snippet.

I will be glad if I can assist you further.

Greetings,
Vanya Pavlova
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Yonghan
Top achievements
Rank 1
answered on 11 Jan 2011, 03:21 AM
Hi, the article "Delete" is works fine. thanks for the tip.
But, Do you think is it simple way? In my opinion, it's be more simple like this:

      var result = MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButton.OKCancel);
      e.Cancel = (result == MessageBoxResult.Cancel.);

Thanks,
0
towpse
Top achievements
Rank 2
answered on 31 Jan 2011, 05:20 PM
isn't there a way to replace all regular confirm dialogs with the rad confirm?

i'm adding a confirm to a template delete column like this

private void RadGrid1_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e)
{
  
if(e.Item is GridDataItem)
  {
   GridDataItem dataItem = e.Item
 as GridDataItem;
   
string contactName = dataItem["ContactName"].Text;

   LinkButton button = dataItem[
"DeleteColumn"].Controls[0] as LinkButton;
   button.Attributes[
 "onclick"] = "return confirm('Are you sure you want to delete " +
   contactName +
 "?')";
  }
}

how can i replace the confirm with the nicer looking rad window confirm?
0
Vlad
Telerik team
answered on 01 Feb 2011, 07:43 AM
Hi,

 I'm not sure how this is related to RadGridView for Silverlight?

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
towpse
Top achievements
Rank 2
answered on 01 Feb 2011, 06:56 PM
oops. didn't realize this was a silverlight thread. i landed here from a google search.
0
Sebastian
Telerik team
answered on 02 Feb 2011, 09:36 AM
Hello Matt,

This is explained in the third paragraph of this documentation article:
http://www.telerik.com/help/aspnet-ajax/grdaddingdeleteprompt.html

Alternatively, you can use the solution presented in the KB article below:
http://www.telerik.com/support/kb/aspnet-ajax/grid/replacing-the-default-confirm-dialog-for-radgrid-with-radwindow-confirm.aspx

Greetings,
Sebastian
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Marc Roussel
Top achievements
Rank 2
answered on 26 Apr 2013, 11:40 PM
I'm not quiet sure but it seems there's a flaw in that documentation for the Delete because saying the Deleting is when the user is about to delete but yes Deleting event is all about performing confirmation before deletion however my line is deleted from the UI even before asking the confirmation in the Deleting event so either I'm lost and I'm stupid or there's really something wrong !?
0
Vanya Pavlova
Telerik team
answered on 29 Apr 2013, 04:54 PM
Hi Marc,

 


Rather unfortunately it is not clear, whether you are referring to the RadGrid for ASP. NET AJAX or RadGridView for Silverlight/WPF. Could you be please more specific? I believe that the best option here is to open a new thread for the corresponding product type and ask your questions there.
In this way it will be much more easier for our support services to provide you with the desired information. 


Have a great day! 


Greetings,
Vanya Pavlova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Marc Roussel
Top achievements
Rank 2
answered on 29 Apr 2013, 04:56 PM
It's ok I found in another thread that I have to set e.Cancel = tru at the begining and ask the confirmation after.
It's all god now
Tags
GridView
Asked by
Yonghan
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Yonghan
Top achievements
Rank 1
towpse
Top achievements
Rank 2
Vlad
Telerik team
Sebastian
Telerik team
Marc Roussel
Top achievements
Rank 2
Share this question
or