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

Thread is closed for posting
2 posts, 0 answers
  1. nelson
    nelson avatar
    11 posts
    Member since:
    Jun 2010

    Posted 16 Jun 2010 Link to this post

     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.

  2. Kusum Dhyani
    Kusum Dhyani avatar
    1 posts
    Member since:
    Aug 2009

    Posted 19 Jun 2010 Link to this post

    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:



    RowSelected(sender, args) {



      var empData; 


      empData.value =  args.getDataKeyValue(

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

Back to Top