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

tooltip for Radgrid hierarchy image Button...

1 Answer 188 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Srinivasa Gokidi
Top achievements
Rank 1
Srinivasa Gokidi asked on 15 Dec 2010, 10:06 PM
Hi,

I am using a Radgrid Hierarchy with girdimagebuttons. And I am ptoviding the tooltip to the buttons using the below code and it works fine.

<telerik:GridButtonColumn UniqueName="EditCMNbr" CommandName="EditCM" ImageUrl="~/Images/edit-icon-v5.gif"
   ButtonType="ImageButton" HeaderStyle-Width="3%" ItemStyle-Width="3%">
</telerik:GridButtonColumn>
<telerik:GridButtonColumn UniqueName="AddSMNbr" CommandName="AddSM" ImageUrl="~/Images/add-icon.png"
   ButtonType="ImageButton" HeaderStyle-Width="3%" ItemStyle-Width="3%">
</telerik:GridButtonColumn>
protected void RGCMnbr_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        ImageButton btnEditCM = (ImageButton)dataItem["EditCMNbr"].Controls[0];
        btnEditCM.ToolTip = "Edit CM";
 
        ImageButton btnAddSM = (ImageButton)dataItem["AddSMNbr"].Controls[0];
        btnAddSM.ToolTip = "Add SM";
    
 
}


The Issue is When i click the Expandcolumn in my radgrid Hierarchy I am getting error like cell bound column is not find. Please see the Images. Please let me know how to achieve this.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 16 Dec 2010, 06:55 AM
Hello Srinivasa,

You are getting this error because you did not distinguish grid rows in hierarchy on ItemDataBound event. You need to identify the table to which the current row belongs like below.

ASPX:
<telerik:RadGrid . . . . .>
     <MasterTableView Name="Master" . . . .>
          . . . . . .

C#:
protected void RGCMnbr_ItemDataBound(object sender, GridItemEventArgs e)
   {
      if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "Master")
       {
           GridDataItem dataItem = (GridDataItem)e.Item;
           ImageButton btnEditCM = (ImageButton)dataItem["EditCMNbr"].Controls[0];
           btnEditCM.ToolTip = "Edit CM";
           ImageButton btnAddSM = (ImageButton)dataItem["AddSMNbr"].Controls[0];
           btnAddSM.ToolTip = "Add SM";
       
   }

Please go through the following documentation for information on this:
Distinguish grid rows in hierarchy on ItemCreated/ItemDataBound

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