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

Client Events unable to work

3 Answers 114 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 14 Jul 2008, 03:14 PM
I have set the following for the RadGrid in my project.
<ClientSettings> 
    <ClientEvents OnRowDeleting="javascript:return confirm('Delete selected record?');"/> 
</ClientSettings>   
 
Initially this client event works perfectly: It would display a confirmation dialog box and will only delete the record if the user approves it. Strangely now the script doesn't work at all. Clicking on the delete command would immediately delete the record. I've even tried the following to no avail.
<script type="text/javascript" language="javascript"
    function ConfirmDelete() 
    { 
        return confirm('Delete selected record?'); 
    } 
</script> 
<ClientSettings> 
    <ClientEvents OnRowDeleting="ConfirmDelete"/> 
</ClientSettings>   
 
Is there some setting that I've left out? Why does it refuse to run any client script?


3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 15 Jul 2008, 05:50 AM
Hi Benjamin,

Try using a GridClientDeleteColumn or a GridButtonColumn to perform the Delete operation so that you can set the ConfirmText property for those columns.

ASPX:
<telerik:GridClientDeleteColumn UniqueName="DeleteCol" ConfirmText="Are You sure?" ></telerik:GridClientDeleteColumn> 


<telerik:GridButtonColumn CommandName="DeleteRow" ConfirmText="You want to delete?" HeaderText="DeleteColumn" ButtonType="LinkButton" Text="DeleteRow" ></telerik:GridButtonColumn> 


Thanks
Shinu.
0
DezTech
Top achievements
Rank 1
answered on 17 Jul 2008, 06:37 PM
CommandName="DeleteRow" did NOT work, but CommandName="Delete" DID.

I was still expecting your ClientSettings-ClientEvents-OnRowDeleting property to allow me to enter my own javascript code for the auto-generated Delete column though...

-Aaron
0
Vlad
Telerik team
answered on 18 Jul 2008, 05:06 AM
Hello Aaron,

OnRowDeleting Will be raised in case of client-side delete:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Client/ClientDelete/DefaultCS.aspx

Regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
DezTech
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or