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
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.
Vanya Pavlova
the Telerik team
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,
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?
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.
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
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!
Vanya Pavlova
the Telerik team
It's all god now