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

Displaying diffrent tooltip on grid and GridButtonColumn

5 Answers 665 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arvind
Top achievements
Rank 1
Arvind asked on 09 Aug 2012, 09:16 AM
Hi,

Is it posible to display diffrent tooltip on whole grid and the diffrent ToolTip on GridButtonColumn. When i try to assign as below, even if i point on the Brid button column, it only displays the grid toolip.

<telerik:RadGrid ID="rgTest" runat="server" AllowAutomaticInserts="false" AutoGenerateColumns="False"
    Skin="Outlook" Height="100%" Width="90%" Culture="en-GB" GridLines="None" CellSpacing="0"
    ShowHeader="False" OnDeleteCommand="rdTest_Delete" ToolTip="<%$Resources: , Grid_tooltip%>" >
<MasterTableView AllowAutomaticInserts="false" CommandItemDisplay="None"         
        CommandItemSettings-ShowRefreshButton="False" DataKeyNames="Id" NoMasterRecordsText=""
        ViewStateMode="Enabled" GridLines="None" EditMode="InPlace" ShowHeadersWhenNoRecords="False">                   
        <Columns>   
            <telerik:GridButtonColumn UniqueName="DeleteCommandColumn" ButtonType="ImageButton"
                CommandName="Delete" ImageUrl="~/Graphics/Remove.png" Text="<%$Resources: , Delete_tooltip%>" HeaderStyle-Width="5%">
                <HeaderStyle Width="5%"></HeaderStyle>
            </telerik:GridButtonColumn>
        </Columns>        
    </MasterTableView>
   </telerik:RadGrid>

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Aug 2012, 09:33 AM
HI,

Try setting the tooltip for ButtonColumn as shown below.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridDataItem)
 {
   GridDataItem item = (GridDataItem)e.Item;
   TableCell cell = (TableCell)item["DeleteCommandColumn"];
   cell.ToolTip = "tooltip";
 }
}

Thanks,
Shinu.
0
Arvind
Top achievements
Rank 1
answered on 09 Aug 2012, 03:17 PM
Hi Shinu,

Thanks for the reply, but it sill did not work, displays only the grid tool tip.

Thanks
0
Jayesh Goyani
Top achievements
Rank 2
answered on 09 Aug 2012, 05:49 PM
Hello,

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridDataItem)
           {
               GridDataItem item = (GridDataItem)e.Item;
               item["DeleteCommandColumn"].ToolTip = "cell tooltip";
               //OR
               (item["DeleteCommandColumn"].Controls[0] as ImageButton).ToolTip = "Button tooltip";
           }
       }


Thanks,
Jayesh Goyani
0
Arvind
Top achievements
Rank 1
answered on 10 Aug 2012, 05:58 AM
Hi Jayesh,

The image button control already has a tool tip assigned from the client side, but still it only displays the grid tooltip always.

Thanks
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Aug 2012, 02:17 PM
Hello,

Please check below code snippet and screenshot.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridDataItem)
           {
               GridDataItem item = (GridDataItem)e.Item;
               item["DeleteCommandColumn"].ToolTip = "cell tooltip";
               //OR
               (item["DeleteCommandColumn1"].Controls[0] as ImageButton).ToolTip = "Button tooltip";
           }
       }
<telerik:RadGrid ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound"
            OnNeedDataSource="RadGrid1_NeedDataSource"
>
            <MasterTableView >
                <Columns>
                    <telerik:GridButtonColumn UniqueName="DeleteCommandColumn" ButtonType="ImageButton"
                        CommandName="Delete" ImageUrl="http://docs.colabolo.com/docs/download/attachments/2065185/icon_delete_small.png"
                        Text="delete">
                    </telerik:GridButtonColumn>
                    <telerik:GridButtonColumn UniqueName="DeleteCommandColumn1" ButtonType="ImageButton"
                        CommandName="Delete" ImageUrl="http://docs.colabolo.com/docs/download/attachments/2065185/icon_delete_small.png"
                        Text="delete">
                    </telerik:GridButtonColumn>
                    <telerik:GridEditCommandColumn>
                    </telerik:GridEditCommandColumn>
                </Columns>
 
            </MasterTableView>
        </telerik:RadGrid>
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            dynamic data = new[] {
              new { ID = 1, Name ="Parent"},
              new { ID = 2, Name = "Parent"},
              new { ID = 3, Name = "Parent"},
              new { ID = 4, Name = "Parent"},
              new { ID = 5, Name ="Parent"}
            };
            RadGrid1.DataSource = data;
        }

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Arvind
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arvind
Top achievements
Rank 1
Jayesh Goyani
Top achievements
Rank 2
Share this question
or