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

RadGrid Client Events OnCommand

3 Answers 236 Views
Grid
This is a migrated thread and some comments may be shown as answers.
francis
Top achievements
Rank 1
francis asked on 08 Nov 2010, 12:48 PM
Hi ,

I have a radgrid with paging enabled on OnCommand of client event i need to display a javascript confirm message box.

The javascript OnCommand method is as follows
function RaiseCommand(sender, args) {
    var result = args.get_commandName();
    if (result == 'Page') {
        if(UnSavedChanges())
        {
            args.set_cancel(true);
        }
    }
}
If command name is Page based on the javascript method "unSavedChanges" that is if true i set cancel to true.

It works as in the data is not displayed of the next page. However the slider moves .
Meaning the slider moves irrespective of whether i set to cancel or not in my case i want the slider to move only is the Method "UnSavedChanges" returns false.

Regards,
Francis P.

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 10 Nov 2010, 05:12 PM
Hello Francis,

This is because the slider has already changed its value by the time RadGrid's page command is fired. So, you cannot prevent the slider from changing in the OnCommand grid event.

Veli
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
0
francis
Top achievements
Rank 1
answered on 12 Nov 2010, 08:12 AM
Hi Veli,

Thanks for your reply . Is it possible for me to manually run this script of moving the slider back or forward . In my case based on
a condition at the client side i would like the grid to move to the next page . ?

Thanks & Regards,
Francis P.
0
Veli
Telerik team
answered on 12 Nov 2010, 02:51 PM
Hi Francis,

If you change the slider value, RadGrid will page again, because it is bound to slider's value change action. One approach you can take would be to handle RadGrid's server-side PageIndexChanged  event and set e.Canceled = true to prevent the grid from actually paging. The grid will still make a postback to the server, but the page will not change.

Veli
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
francis
Top achievements
Rank 1
Answers by
Veli
Telerik team
francis
Top achievements
Rank 1
Share this question
or