RadToolTip(Manager) on RadGrid column header

9 posts, 0 answers
  1. Gosha
    Gosha avatar
    36 posts
    Member since:
    Aug 2010

    Posted 20 Sep 2010 Link to this post

    I have RadGrid with many custom filters and I want to use RadToolTip(Manager) to show tooltip window with information of applied filter on column with filter. Tooltip can be closed by user manually and then I programmatically remove filter. I have been trying unsuccessfully for three hours to attach RadToolTip to column header because that element does not have either server or client ID. How to open programmatically RadToolTip over column name?
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 23 Sep 2010 Link to this post

    Hi Sasa,

     You can use the ClientID of the cell as shown below:


    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
       {
           if (e.Item.ItemType == GridItemType.Header)
           {
               GridHeaderItem item = e.Item as GridHeaderItem;
               foreach (TableCell cell in item.Cells)
               {
                   if ((cell.Controls.Count > 0))
                   {
                       // add tooltip to header title link   
                       RadToolTipManager1.TargetControls.Add(cell.ClientID, true);
                   }
               }
           }
       }

    Please, test this solution and let us know how it goes.

    All the best,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Gosha
    Gosha avatar
    36 posts
    Member since:
    Aug 2010

    Posted 23 Sep 2010 Link to this post

    How to run this code?
    I cant call Header ItemEvent, how to do that?
    I tried everything with grid but get only pager ItemEvent!
  5. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 23 Sep 2010 Link to this post

    Hello Sasa,

    The RadGrid has an ItemDataBound event, you would attach it like this:

    <telerik:RadGrid ID="RadGrid1" runat="server" OnItemDataBound="RadGrid1_ItemDataBound">
    </telerik:RadGrid>

    I hope that helps.
  6. Gosha
    Gosha avatar
    36 posts
    Member since:
    Aug 2010

    Posted 23 Sep 2010 Link to this post

    Now code is runing but nothing heapends. There is no tooltip. This appears to be too much for me. Can you just explain to me what to enter in button.click event sub to display RadToolTipManager1 baloon over column header "abc" ?
  7. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 23 Sep 2010 Link to this post

    Hello Sasa,

    Try this approach instead.

    ASPX Page:

    <div id="zone">
                <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnItemDataBound="RadGrid1_ItemDataBound"
                    OnNeedDataSource="RadGrid1_NeedDataSource">
                    <MasterTableView ShowHeadersWhenNoRecords="true">
                        <Columns>
                            <telerik:GridBoundColumn DataField="ABC" HeaderText="ABC">
                            </telerik:GridBoundColumn>
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </div>
            <telerik:RadToolTipManager ID="RadToolTipManager1" runat="server" AutoTooltipify="true"
                ToolTipZoneID="zone">
            </telerik:RadToolTipManager>

    Code-Behind:

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.Header)
            {
                GridHeaderItem item = e.Item as GridHeaderItem;
                foreach (TableCell cell in item.Cells)
                {
                    cell.ToolTip = cell.Text;
                }
            }
        }

    I hope that helps.
  8. Gosha
    Gosha avatar
    36 posts
    Member since:
    Aug 2010

    Posted 23 Sep 2010 Link to this post

    That works on mouse over but I want to open tooltip from code. I have one button and when I click on it to show tooltip on column(5) header.
  9. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 24 Sep 2010 Link to this post

    Hi Sasa,

     I suggest to simply set ShowEvent="OnClick"  for the tooltip as explained below:

    http://demos.telerik.com/aspnet-ajax/tooltip/examples/showevent/defaultcs.aspx

    Greetings,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  10. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 24 Sep 2010 Link to this post

    Hi Sasa,

     I suggest to simply set ShowEvent="OnClick"  for the tooltip as explained below:

    http://demos.telerik.com/aspnet-ajax/tooltip/examples/showevent/defaultcs.aspx

    Greetings,
    Svetlina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017