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

RadGrid DoubleClick Problem

2 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Keven
Top achievements
Rank 1
Keven asked on 06 Dec 2010, 04:48 PM
Hello,

I have a problem with the DoubleClick on a RadGrid. When I double click on my grid, my javascript function doesn't want to give me my first column data unless it is visible. Is it possible to do it with my column invisible ?

I use the following javascript function
function OnRowDblClick(sender, eventArgs) 
    
        var dataItem = $get(eventArgs.get_id()); 
        var grid = sender; 
        var MasterTable = grid.get_masterTableView(); 
        var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; 
        var cell = MasterTable.getCellByColumnUniqueName(row, "NO_SERVEUR"); 
        var value = cell.innerHTML 
        window.location.href='FEN_INFO_SERVEUR.aspx?No_Serveur='+value; // Redirect the page         
        return;

Thanks

Keven

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 07 Dec 2010, 07:04 AM
Hello Keven,


Set the Display property of column as "False" instead of Visible property, so that you can access the cell value even if the column is hidden (in client side).

Another option (if your first column field is set as ClientDataKeyNames) is using 'getDataKeyValue' method to get corresponding cell value.
code - javascript:
function OnRowDblClick(sender, eventArgs) {
    var dataItem = $get(eventArgs.get_id());
    var grid = sender;
    var MasterTable = grid.get_masterTableView();
    var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
    alert(row.getDataKeyValue('ColumnUniqueName'));
}
 
where the mark-up is:
<MasterTableView CommandItemDisplay="Top" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1"
    Width="100%" Name="Master" HierarchyLoadMode="Client" ClientDataKeyNames="ColumnUniqueName">
    <Columns>                 
        <telerik:GridBoundColumn Visible="false" AllowFiltering="true" SortExpression="ColumnUniqueName" HeaderText="ColumnUniqueName"
            DataField="ColumnUniqueName" UniqueName="ColumnUniqueName">
        </telerik:GridBoundColumn>



-Shinu.
0
Keven
Top achievements
Rank 1
answered on 07 Dec 2010, 05:02 PM
Thanks a lot Shinu !

Every thing works perfectly now.
Tags
Grid
Asked by
Keven
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Keven
Top achievements
Rank 1
Share this question
or