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

ConfirmText ignoring result

2 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike Kacos
Top achievements
Rank 1
Mike Kacos asked on 03 Nov 2010, 03:16 PM
Hi,
    I might be misunderstanding the use of ConfirmText on a GridButtonColumn, but if the user chooses "Cancel" then I would expect the ItemCommand event would not fire?  We have a grid with a Delete button seen here
<telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton"
                    ConfirmText="Are you sure you want to delete this attachment?">
                    <HeaderStyle Width="20px" />
                </telerik:GridButtonColumn>
 
The code for performing the delete occurs in the ItemCommand event.  Unfortunately no matter what the user chooses (both Ok or Cancel) the event still fires performing the delete.  Is this the correct behavior?  If so, is there an argument I can grab from the GridCommandEventArgs to determine if the user select Ok or Cancel?

Thanks,
Mike

2 Answers, 1 is accepted

Sort by
0
Mike Kacos
Top achievements
Rank 1
answered on 03 Nov 2010, 04:09 PM
Nevermind, it turns out a Jquery library we were using to confirm User Changes before navigating away from the page was causing the issue.  FYI. by changing the ButtonType to a LinkButton also fixed the issue, but we wanted an ImageButton for this specific column.

Thanks,
-Mike
0
Vasil
Telerik team
answered on 03 Nov 2010, 04:23 PM
Hi Mike Kacos,

The behavior that you described is not normal for the GridButtonColumn.
When I use your code, in a simple grid, it work perfectly. No server-side event is firing on click Cancel button here.

When I inspected the rendered HTML for this cell of the grid it looked like this:

<input type="image"
style="border-width: 0px;"
onclick="if(!confirm('Are you sure you want to delete this attachment?'))return false;"
alt="Delete"
src="/SimpleWebSite/WebResource.axd?d=QP7......"
title="Delete"
id="RadGrid1_ctl00_ctl08_gbccolumn"
name="RadGrid1$ctl00$ctl08$gbccolumn">

Please check your code for duplicated definition of the delete column.

Try to debug the JavaScript with FireBug (or another tool), and see what exactly is going on when press cancel and what HTML is rendered on the client.

Regards,
Vasil
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
Tags
Grid
Asked by
Mike Kacos
Top achievements
Rank 1
Answers by
Mike Kacos
Top achievements
Rank 1
Vasil
Telerik team
Share this question
or