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

How to get the radgrid selected row values on row selection ?

1 Answer 248 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
nelson
Top achievements
Rank 1
nelson asked on 16 Jun 2010, 11:36 AM
 hi, i bind a employee table to my RadGrid so my columns for RadGrid are 'emp_name', 'emp_dept', 'emp_city'.

now, what i want is when i select a perticular row of RadGrid i need to access all the values of that perticular row in a javascript function.

i tried to find these values in 'args' but i havn't found the luck.

Please help.

1 Answer, 1 is accepted

Sort by
0
Kusum Dhyani
Top achievements
Rank 1
answered on 20 Jun 2010, 04:02 AM
You should first define the columns that you wish to extract within the ClientDataKeyNames property in your MasterTableView tag:

<

 

MasterTableView width="100%" AllowPaging="true" AutoGenerateColumns="true" HeaderStyle-Width="100px" ItemStyle-Width="100px" AllowMultiColumnSorting="true" ClientDataKeyNames="emp_name, emp_city, emp_dept" >

 

Now you can access the columns in your javascript using getDataKeyValue thus:

function

 

RowSelected(sender, args) {

 

 

  var empData; 

 

  empData.value =  args.getDataKeyValue(

"emp_name") + ',' + args.getDataKeyValue("emp_city") + ',' + args.getDataKeyValue("emp_dept");
}
Hope this helps.
Thanks.
Kusum.

Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
nelson
Top achievements
Rank 1
Answers by
Kusum Dhyani
Top achievements
Rank 1
Share this question
or