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

Obtaining Selected Record from Rad Grid Control

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Geoffrey
Top achievements
Rank 1
Geoffrey asked on 31 Jan 2011, 09:34 PM
I need to obtain a single selected record from a radGrid control triggered by a user double click event. I'd like to pass the selected record with a column named ID. I believe JavaScript is the best approach to do this since it will avoid post backs which cause the page to flash. Although, I've had no success getting it to work. I'm new to Telerik and could use any help, suggestions and/or examples you may have...

Visual studio 2010
ASP.Net Web Application

Thanks 

Geoff

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 01 Feb 2011, 05:48 AM
Hello Geoffrey,

The following code snippet shows how to get the selected row and cell value in 'RowDblClick' event.

ASPX:
<ClientSettings Selecting-AllowRowSelect="true">
    <ClientEvents OnRowDblClick="RowDblClick" />
</ClientSettings>

Java Script:
<script type="text/javascript">
    function RowDblClick(sender, args) {
        debugger;
        var grid = sender;
        var MasterTable = grid.get_masterTableView();
        var row = args.get_item(); //accessing row
        var cell = MasterTable.getCellByColumnUniqueName(row, "EmployeeID").innerHTML;//get cell value
    }
   
</script>

Also refer the following documentation which shows how to get the selected row and cell value from client side.
Getting cell values for selected rows client side

Thanks,
Princy.
0
Geoffrey
Top achievements
Rank 1
answered on 01 Feb 2011, 03:10 PM
Princy your awesome! Your example works great!

Thanks a lot for your help, it is very much appreciated!

Geoff
Tags
Grid
Asked by
Geoffrey
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Geoffrey
Top achievements
Rank 1
Share this question
or