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

how to display warning when user exits grid with in-place editing when item is still in edit mode

7 Answers 126 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Judith Murgia
Top achievements
Rank 1
Judith Murgia asked on 10 Nov 2010, 07:25 PM
Hi,

I have a radgrid with inplace editing. Everything works fine, but now I want to add a warning if the user exits the grid while an item is still in edit mode, is there an easy way to do this?

Thanks,
Judy

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2010, 06:21 AM
Hello Judy,


By attaching "OnCommand" event, you can check for the CommandName and show the confirm accordingly. Here shown a sample code.

Client code:
function OnCommand(sender, args) {
    var commandName = args.get_commandName();    
    if (sender._editIndexes.length > 0) {
        if (commandName == "CancelUpdate") {
            args.set_cancel(!confirm("You have not saved the data, do you want to continue...?"));
        }
    }
}



-Shinu.
0
Judith Murgia
Top achievements
Rank 1
answered on 22 Nov 2010, 05:56 AM

Thanks for the reply, do you know how I would do that from  vb code behind?

I also tried to use the following which I think might work, but it keeps telling me that 'Telerik.WebControls.GridCommandEventArgs' is not defined? 

 

Protected Sub RadGrid1_EditCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs)
    Response.Write("Edit")
End Sub

Thanks,

Judy
0
Judith Murgia
Top achievements
Rank 1
answered on 22 Nov 2010, 05:56 AM

Thanks for the reply, do you know how I would do that from  vb code behind?

I also tried to use the following which I think might work, but it keeps telling me that 'Telerik.WebControls.GridCommandEventArgs' is not defined? 

 

Protected Sub RadGrid1_EditCommand(ByVal source As Object, ByVal e As Telerik.WebControls.GridCommandEventArgs)
    Response.Write("Edit")
End Sub

Thanks,

Judy
0
Nikolay Rusev
Telerik team
answered on 22 Nov 2010, 08:51 AM
Judith Murgia,

The code posted by Shinu seems to be JavaScript /i.e client script/ and it does not have server code alternative C#/VB.

Regards,
Nikolay
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Judith Murgia
Top achievements
Rank 1
answered on 22 Nov 2010, 02:11 PM
Ok - what about the error I get when I try to use the Radgrid1_EditCommand (see code above), do you know why I get this, I have these declarations :

Imports

 

Telerik.Web.SessionDS

 

Imports

 

Telerik.Web.UI

Thanks

 

0
Judith Murgia
Top achievements
Rank 1
answered on 22 Nov 2010, 02:11 PM
Ok - what about the error I get when I try to use the Radgrid1_EditCommand (see code above), do you know why I get this, I have these declarations :

Imports

 

Telerik.Web.SessionDS

 

Imports

 

Telerik.Web.UI

Thanks

 

0
Nikolay Rusev
Telerik team
answered on 23 Nov 2010, 09:08 AM
Hello Judith,

In Telerik.Web.UI assembly there is no Telerik.WebControls namespace. It should be Telerik.Web.UI I suppose.

Regards,
Nikolay
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Judith Murgia
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Judith Murgia
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or