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

Cancelling a deselection

2 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 06 Mar 2008, 11:41 AM
Hi,

Under certain circumstances I want to stop the user from changing the selection in the grid.  I have hooked up the OnRowSelecting and OnRowDeselecting events which will both check the value of a client-side variable to say whether the action can occur.  Here is an example of my client-side events code:

function GridRowSelecting( sender, eventArgs )  
{  
    if( CanSelectionChange() )  
    {     
        // .... do whatever I need to do  
        return true;  
    }  
      
    eventArgs.set_cancel( true );  
    return false;  
}  
 
function GridRowDeselecting( sender, eventArgs )  
{  
    if( CanSelectionChange() )  
    {     
        // .... do whatever I need to do  
        return true;  
    }  
      
    eventArgs.set_cancel( true );  
    return false;  
}  
 

This works fine for selecting - the event is cancelled and the new selection is not accepted.  However, when there is already an item selected in the grid, attempting to select another item results in the first item being deselected prior to the new item being selected.  The GridRowDeselecting event is correctly entered and the function chooses to disallow the deselection by setting set_cancel.  This then results in an IE popup window stating that the script has become unresponsive, and upon debugging the JavaScript, using set_cancel results in the OnRowDeselecting event infinitely firing and eventually the application breaks.

Can anyone suggest a reason why this is?  Am I cancelling the deselection event correctly?

2 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 07 Mar 2008, 06:48 AM
Hello Jonathan,

We have to admit about this problem in the previous Prometheus RadGrid release, we have addresseed that prior to uploading the latest release labeled 2007_3_1425. Can you please double-check you have updated the Web.UI assembly in the project where the issue is observed?

Let us know if further assistance is needed.

All the best,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jonathan
Top achievements
Rank 1
answered on 07 Mar 2008, 11:14 AM
Hi Konstantin,

I had installed 1425 and thought I was using it but it turns out part of my project was still referencing a 1338 version of the DLL.  Once I sorted that out, you are quite correct and this now works as I expect.

Thanks for your help!
Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or