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

[Solved] Edit Grid like Windows Explorer

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jsearl
Top achievements
Rank 1
jsearl asked on 28 Jan 2010, 10:27 PM
I am using a RadGrid to display files and folders in a given directory.  To rename the files and folders, I would like to be able to first highlight a row by clicking on that row, and then upon clicking the already highlighted row again have the RadGrid go into edit mode allowing me to edit the Name cell.  The behavior I am looking for is like that seen in Windows Explorer (Details View).  I have tried implementing this by setting the EditMode="InPlace" and setting columns I don't need to edit to ReadOnly="true".  On the clientside RowClick event I tried only putting the grid in editMode only after the row was already selected, but was not having any luck.   Any help would be appreciated.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Jan 2010, 08:53 AM
Hi,

Try the  javascript below to achieve the desired scenrio. You will need to attach the Client Events as shown below:

ASPX:

<ClientSettings> 
            <ClientEvents OnRowClick="RowClick" OnRowSelected="RowSelected"  
                OnGridCreated="gridCreated" OnRowCreated="OnRowCreated" /> 
            <Selecting AllowRowSelect="true" /> 
</ClientSettings> 


JS:

function OnRowCreated() { 
 
    }  
 
 
 function gridCreated() { 
 
    }  
 
var index = null
var click = 0; 
function RowSelected(sender, args) { 
        var dataitem = args.get_gridDataItem(); 
        if (index != dataitem._itemIndexHierarchical) { 
            click = 0; 
        } 
    } 
 
function RowClick(sender, args) { 
        var dataitem = args.get_gridDataItem(); 
        index = dataitem._itemIndexHierarchical; 
        if (click == 1) { 
            var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView(); 
            masterTable.fireCommand("Edit", index); 
        } 
        else { 
            click = 1; 
        }  
    }  
 


Thanks,
Princy
Tags
Grid
Asked by
jsearl
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or