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

Way to have a delete button not count as a rowclick

3 Answers 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 24 Jul 2008, 08:04 PM
We have a radgrid that with AllowAutomaticDeletes set to true.

However, we DO NOT SET AutoGenerateDeleteColumn to true.  This is because we want a delete image that displays a confirmation box.  We cannot find any way to do this with a DeleteColumn.

To get around that, we use a GridButtonColumn.  This works OK but, the problem is that clicking on the button also counts as a rowclick, which we currently use to send the user to a new page using OnItemCommand.

What is the best way to have a DeleteColumn/ButtonColumn display a confirmation box, but still allow the rest of the row to be clicked for edit purposes?

3 Answers, 1 is accepted

Sort by
0
tom
Top achievements
Rank 1
answered on 24 Jul 2008, 08:48 PM
We continued to test this.

The problem is that any column (even an auto-generated delete column) fires the RowClick event.  This works fine during an inline edit, but we want to send the user to a new page on a RowClick, but still give the delete functionality on the grid.

Suggestions?
0
Sebastian
Telerik team
answered on 28 Jul 2008, 12:50 PM
Hi Tom,

Since the OnRowClick client event of RadGrid is cancellable, you can determine whether the checkbox control is the target of the click and prevent the postback operation by invoking eventArgs.set_cancel(true).

How to identify the target control of the end user click you can find out from the following code library entry:

http://www.telerik.com/community/code-library/submission/b311D-kkgkm.aspx


Thus you will be able to delete records and prevent the redirect on delete button click.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
tom
Top achievements
Rank 1
answered on 27 Oct 2008, 06:16 PM
we got it to work by doing the following to our radgrid:
<ClientSettings> 
        <ClientEvents OnRowClick="RowClick" /> 
</ClientSettings> 

then added the following javascript:

<script type="text/javascript" language="javascript"
    function RowClick(sender, eventArgs)  
    {  
    var tableView = eventArgs.get_tableView();   
    var rowIndex = eventArgs.get_itemIndexHierarchical(); 
 
    tableView.editItem(rowIndex); 
    } 
</script> 

this allows the delete column to work correctly and still lets row-click function as our edit link

thanks
Tags
Grid
Asked by
tom
Top achievements
Rank 1
Answers by
tom
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or