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

Client side, get controls values on same row

1 Answer 250 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 16 Jun 2010, 02:04 AM
Hi
On thread:
http://www.telerik.com/community/forums/aspnet-ajax/grid/get-row-number-of-grid.aspx
It shows the following:
<script type="text/javascript" language="javascript">  
    function onFocus(sender, args)  
    {  
        var cell = sender.get_element().parentNode.parentNode;  
        alert(cell.parentNode.rowIndex);  
    } 
</script> 
The above gets the row index. 
It seem to me that parentNode.ParentNode gets one to the row.  If context is correct, so from there I should be able to find other controls in the grid data row.  So how do I find the data row object context (not html) and then find other controls.

Phil

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Jun 2010, 01:21 PM
Hello Phil,

Access the client object of griditem and use findElement() / findControl() methods to access the controls placed in same row.

Java Script:
<script type="text/javascript"
   function onFocus(sender, args) 
   { 
        var rowindex;
          . . .
        var grid = $find("<%=RadGrid1.ClientID %>"); 
        var MasterTable = grid.get_masterTableView(); 
        var textbox = MasterTable.get_dataItems()rowindex].findElement("TextBox1");   //accessing standard asp.net server controls 
        var radTextbox= MasterTable.get_dataItems()[rowindex].findControl("RadTextBox2");  //accessing RadControls 
   }  
</script> 

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