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

[Solved] Manipulating Rows on client side

2 Answers 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Asad
Top achievements
Rank 1
Asad asked on 13 May 2009, 12:11 AM
Hi

I have been struggling with RAD Grid all day today. But i couldn't find if we can manipulat Rows/cells on client side.

E.g., I want to assign value to the tooltip of some cells based on the value of the cell, when a row is data bound. Can i do something like:

eventArgs.row.cells["Name"].tooltip = 'xyz';


        <Columns>
          <telerik:GridBoundColumn DataField="ID" HeaderText="ID" />
          <telerik:GridBoundColumn DataField="Name" HeaderText="Name" />
          <telerik:GridBoundColumn DataField="Age" HeaderText="Age" />
          <telerik:GridBoundColumn DataField="Sex" HeaderText="Sex" />
          <telerik:GridBoundColumn DataField="Email" HeaderText="Email" />
          <telerik:GridBoundColumn DataField="Phone" HeaderText="Phone" />
        </Columns>

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 13 May 2009, 05:10 AM
Hello Asad,

To access columns on the client you can set UniqueName for columns and then try the following code to set the tooltip for a particular cell(on RowMouseOver client event):
aspx:
 
<telerik:RadGrid DataSourceID="SqlDataSource1" runzt="server" ID="RadGrid1">     
    <MasterTableView>   
     <Columns>   
          <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name"></telerik:GridBoundColumn>          
      </Columns>  
   </MasterTableView>                  
  <ClientSettings>      
     <ClientEvents OnRowMouseOver="RowMouseOver" />                     
  </ClientSettings>           
</telerik:RadGrid>  

js:
function RowMouseOver(sender, eventArgs) 
 {   
   var MasterTable = eventArgs.get_tableView();    
   var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()]; 
   var cell = MasterTable.getCellByColumnUniqueName(row, "Name"); 
   cell.title = "xyz";    
 } 

Thanks
Princy.
0
Asad
Top achievements
Rank 1
answered on 13 May 2009, 10:11 PM
Thanks for the response,

but, it seems you are assigning tooltip to the header column only. I want to add tooltip to each field of a column; depending on the vlaue of the cell. the functionality is similar to a message list page of an email client, where the people in 'To' field will be shown in a tooltip if the value doesn't fit in the cell width.
Tags
Grid
Asked by
Asad
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Asad
Top achievements
Rank 1
Share this question
or