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

Get Row values From radGrid by clicking a raw - client side

5 Answers 906 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kks
Top achievements
Rank 1
kks asked on 16 Nov 2008, 02:31 PM
Hi telerik,

  I was using telerik version Q3 2007 in my project. now we chenged this to Q3 2008.
i am using rowSelected()  function to get values from grid( client side).  like..

function RowClick(rowObject) // function to display details when click on Mr headers

 

{

 

document.getElementById("ctl00_PlaceHolderMain_inputPONumber").value = this.GetCellByColumnUniqueName (rowObject,"poNumber").innerText ;
}

after changing to Q3 2008 this code is not working. can you tel me instead of this which i can use.?

 

 

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Nov 2008, 04:16 AM
Hello,

You can go through the following help link which explains how to get cell values for selected rows.
Getting cell values for selected rows client side

Thanks
Princy.
0
kks
Top achievements
Rank 1
answered on 17 Nov 2008, 05:33 AM
hi..
thnax princy..

   so i need to replace all code in RawSelected() function in the whole project if i am upgrading to Q3 2008.
one more question,
i could see one more option , displaying row values using a input button.
is there any option , that i can keep this input button ( or any other control) in each raw and clicking this control i need to get all the cell values.
thanx
0
Shinu
Top achievements
Rank 2
answered on 17 Nov 2008, 12:56 PM

Hi,

You can use the onRowMouseOver client side handler to get the index of the currently active row and store it in a variable. Then, in the onClick handler for the linkButton, you can access the variable, and it will keep the value of the last row over which the user hovered with the mouse. You can refer the code given below:
aspx:

 <MasterTableView>     
   <Columns> 
      <telerik:GridTemplateColumn> 
        <ItemTemplate> 
            <asp:Button ID="Button1" OnClientClick="Show()" runat="server" Text="Button" /> 
        </ItemTemplate> 
        </telerik:GridTemplateColumn> 
   </Columns>   
   </MasterTableView> 
 <ClientSettings> 
 <ClientEvents OnRowMouseOver="RowMouseOver" /> 
 </ClientSettings>   

js:

<script type="text/javascript">     
    
      var index;     
      function RowMouseOver(sender, eventArgs)     
      {      
        index=eventArgs.get_itemIndexHierarchical();     
      }     
     function Show()     
      {     
          var grid = $find("<%=RadGrid1.ClientID %>");     
          var MasterTable = grid.get_masterTableView();       
        
          var Row = MasterTable.get_dataItems()[index];     
          var cell = MasterTable.getCellByColumnUniqueName(Row, "ProductName");  
          alert(cell.innerHTML)  
      }                
</script>   

Thanks
Shinu.

0
HL
Top achievements
Rank 1
answered on 07 Apr 2011, 05:29 PM
is any way to get the cell which is not visible ? example:
<telerik:gridboundcolumn DataField="Note" Visible="false" UniqueName="Note"/> 

after I changed the visible to true then every thing works fine but I need to set this column to false.
var cell = masterTableView.getCellByColumnUniqueName(activeRow, "Note");  
if ( cell != null)
{ alert('find it');
}


Thanks
Helena
0
Princy
Top achievements
Rank 2
answered on 08 Apr 2011, 05:45 AM
Hello Helena,

If you set the columns visible property to 'False' at server side, you cannot access the column value at client side. Because the control is not renderd when setting its visibility as false. You can overcome this problem by setting the Display property of column as 'False'.

Thanks,
Princy.
Tags
Grid
Asked by
kks
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
kks
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
HL
Top achievements
Rank 1
Share this question
or