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

Get unformatted value of RadGridItem Cell

2 Answers 115 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Megan Vee
Top achievements
Rank 1
Megan Vee asked on 12 Jan 2011, 02:53 PM
I am using this code in the ItemDataBound function of my radGrid in order to set the tooltip to the text of the cell:
if(e.Item is GridDataItem) 
   foreach(TableCell cell in e.Item.Cells) 
   
       cell.ToolTip = cell.Text; 
   
}

I am formatting the column to hide all decimals for space reasons, but I am also using filtering. It is possible that one filters for say where column xyz >= 50 and a row showing 50 will not show up because the value is really 49.6.
I would like the tooltip to shop 49.6, not 50.

Is this possible?

Thank you for any expert advice.
-Megan

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jan 2011, 07:12 AM
Hello Megan,


Modify your code as shown below to get it working. I am assuming that you are using GridBoundColumns.

Code:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem item = (GridDataItem)e.Item;
        DataRowView rowView = (DataRowView)item.DataItem;
        foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
        {
            if (col is GridBoundColumn)
            {
                item[col.UniqueName].ToolTip = rowView[col.UniqueName].ToString();
            }
        }
    }
}



-Shinu.
0
Megan Vee
Top achievements
Rank 1
answered on 13 Jan 2011, 09:33 AM
Thank you so much, Shinu! Works like a charm.
Much appreciated.
-Megan
Tags
Grid
Asked by
Megan Vee
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Megan Vee
Top achievements
Rank 1
Share this question
or