The problem that i am facing is, when i delete one row in grid, i need to do some checking then prompt it alert message in screen.
As i know, when we do deletion in grid, it only can call to code behind
protected
void radImp_DeleteCommand(object source, Telerik.WebControls.GridCommandEventArgs e)
{
string sOBFPkID = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString();
Utility.
BaseDelete.DeleteApplFacCollatREImprovement(sOBFPkID);
}
before i delete that record i need to do some checking first,if that record fulfill to my checking then i need to prompt a alert msg in screen.
How can i make it??
Thanks
5 Answers, 1 is accepted
You can prompt just before submitting the form using ConfirmText of GridButtonColumn however in your case you will need to perform double post-back to achieve your goal. The first post-back will be to perform desired checking and display desired alert using RadAjaxManager.ResponseScripts.Add("alert('Your text!');"). and the second post-back will be the actual record delete.
Regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

I'm having the exact problem my self.
Could you please provide some example code?
Regards
Per
How to display a confirmation dialog on delete operation you can see from the following article in the RadGrid for ASP.NET AJAX documentation:
http://www.telerik.com/help/aspnet-ajax/grid-adding-delete-prompt.html
Feel free to modify/expand the solution to conform to your custom logic.
Best regards,
Sebastian
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.

Hi I also need the same solution. Also please note that right now we are using Trial version.
The article you have shown is binding grid at design time.
I am populating grid during runtime, so I do not have any item in radgrid at design time.
Even I cound not find "DeleteColumn" using the code.
Here is my code behind for my radgrid.
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px">
<tr>
<td>
<telerik:RadGrid ID="radUserGrid" AllowFilteringByColumn="True"
AllowSorting="True" PageSize="5"
ShowFooter="True" AllowPaging="True" runat="server" GridLines="None"
AutoGenerateDeleteColumn="True" AutoGenerateEditColumn="True">
<ClientSettings>
<Selecting AllowRowSelect="True" />
</ClientSettings>
</telerik:RadGrid>
</td>
</tr>
</telerik:RadAjaxPanel>
Your prompt response will be highly appreciated.

You can try the following code snippet to display confirmation dialog for AutoGeneratedDeleteColumn.
C#:
protected
void
radUserGrid_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem dataItem = e.Item
as
GridDataItem;
LinkButton button = dataItem.FindControl(
"AutoGeneratedDeleteButton"
)
as
LinkButton;
button.Attributes[
"onclick"
] =
"return confirm('Are you sure you want to delete ?')"
;
}
}
Thanks,
Princy.