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

Confirmation message after save,delete

1 Answer 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Jakech
Top achievements
Rank 1
Robert Jakech asked on 14 Apr 2010, 06:17 AM
I am having it rough displaying a simple message on a label when i save or delete records.

 Scenario:1

I have a USERCONTROL from which i insert,delete,update records.
I call the usercontrol from within my RADGRID.(Editing records in a radgrid via a usercontrol).
Now, i want to return a label with a confirmation message that the records have been saved or deleted.

Scenario:2
I am editting, inserting or deleting records from within RADGRID. I want a similar confirmation message when i successfully insert or delete a record.

NOTE: In both scenarios, i have master pages and ajax enabled on the RadGrid.


Can someone kindly post me a code snippet Becuase this seems to be easy on the paper but not that easy when you get down with it.

thanks in adavance.

The label should be on the USERCONTROL or worst case scenario display the message within the RadGrid.


1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 16 Apr 2010, 12:16 PM
Hi Robert,

One suggestion would be attaching the OnCommand event to RadGrid and cancel the command if confirmation returns false. The event can be canceled by using the method 'eventArgs.set_cancel(true)'.

ASPX:
<ClientSettings>  
    <ClientEvents OnCommand="OnCommand" />  
</ClientSettings

JavaScript:
<script type="text/javascript">  
function OnCommand(sender, args)  
{  
    if(args.get_commandName() == 'Update' || args.get_commandName() == 'PerformInsert')  
    {  
        if(!confirm ('Do you want to continue ?'))  
        {  
            args.set_cancel(true); //cancel the command  
        }  
    }  
}  
</script>  


Kind regards,
Maria Ilieva
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
Robert Jakech
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or