Tool tip not displaying in RadGrid GridHeaderItem

5 posts, 0 answers
  1. R2
    R2 avatar
    63 posts
    Member since:
    Sep 2007

    Posted 08 Jan 2009 Link to this post

    Posted 52 minutes ago (permalink)

    Hi,

    I am learning the RADGrid control. The following code of page 459 does not work:

    imports Telerik.WebControls  
    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As  
    Telerik.WebControls.GridItemEventArgs)  
    'Check for GridHeaderItem if you wish tooltips only for the header cells  
    If TypeOf e.Item Is GridHeaderItem Then  
    Dim headerItem As GridHeaderItem = TryCast(e.Item, GridHeaderItem)  
    headerItem("CreditRating").ToolTip = "CreditRating" 
    headerItem("PreferredVendorStatus").ToolTip = "PreferredVendorStatus" 
    headerItem("ActiveFlag").ToolTip = "ActiveFlag" 
    End If  
    End Sub 
     First, there's a problem with the namespace.  There is a squiggly line under the namespace explained as follows:

    "Namespace or type specified in the Imports 'Telerik,WebControls' doesn't contain any public member or cannot be found.  Make sure the namespace or the type is defined and contains at least one public memeber.  Make sure the imported element name doesn't use any aliases."

    So I guess that means that 'WebControls' is not a member of Telerik?

    Next, Type 'GridHeaderItem' is not defined.

    I deleted the 'Telerik.WebControls' namespace and used the 'Telerik.Web.UI' namespace.  I revised the code to:

    Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)  
            'Check for GridHeaderItem if you wish tooltips only for the header cells     
            If TypeOf e.Item Is GridHeaderItem Then  
                Dim headerItem As GridHeaderItem = TryCast(e.Item, GridHeaderItem)  
                headerItem("CreditRating").ToolTip = "CreditRating" 
                headerItem("PreferredVendorStatus").ToolTip = "PreferredVendorStatus" 
                headerItem("ActiveFlag").ToolTip = "ActiveFlag" 
            End If  
        End Sub 

    The application ran, but I can not see the Tool tips.  Is there a correction written somewhere for this?

    Thanks!
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 12 Jan 2009 Link to this post

    Hi R2,

    I am afraid I cannot tell what exactly causes the problem with the unrecognzed reference to the assembly and this is a general ASP.NET error and not specific for RadControls - you can find more infor,ation abiout it along with suggestions for solution of the problem in this help article.

    As far as I can see from your code, you actually are not using a RadToolTip as you have selected in your ticket but you want to show a standard browser tooltip. I also noticed that you are using RadGrid for ASP.NET and not RadGrid for ASP.NET AJAX - please always provide such version information because it is needed in order to faster assist in the problem solution.

    I suggest to use the grid's OnPreRender event to set the desired tooltips as shown below:

    protected void RadGrid1_PreRender(object sender, EventArgs e)  
        {  
            GridHeaderItem header = (GridHeaderItem)RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0];  
            header["CompanyName"].ToolTip = "CompanyName ToolTip here";  
            header["CustomerID"].ToolTip = "CustomerID ToolTip here";  
            header["ContactName"].ToolTip = "ContactName ToolTip here";  
            header["City"].ToolTip = "City ToolTip here";  
            header["Phone"].ToolTip = "Phone ToolTip here";  
        }   

    For your convenience I attached a sample demo to the thread.

    Greetings,
    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. R2
    R2 avatar
    63 posts
    Member since:
    Sep 2007

    Posted 13 Jan 2009 Link to this post

    Thank you, Svetlina, for your response.

    When you say:
    "As far as I can see from your code, you actually are not using a RadToolTip as you have selected in your ticket but you want to show a standard browser tooltip. I also noticed that you are using RadGrid for ASP.NET and not RadGrid for ASP.NET AJAX - please always provide such version information because it is needed in order to faster assist in the problem solution."

    Please note that I am doing the lesson on page 459.  Which RadGrid is this lesson using -- ASP.NET or ASP.NET AJAX?  The lesson is not instructing me how to use the RadToolTip, it is creating the tool tips programmatically -- which is why I displayed the code that the lesson provides.  Also, I am using VB, not C#.  Could you put your example code in VB please? 

    I also reviewed the Telerik Trainer video for the RadTooltip.  I understand the tooltip property, that's easy.  What is not easy is creating a tooltip for a Grid Header Item in the RadGrid control.  How is this done?

    Sincerely,
    R2
  5. R2
    R2 avatar
    63 posts
    Member since:
    Sep 2007

    Posted 13 Jan 2009 Link to this post

    Also, Svetlina, your example is using the .NEt Framework 2.0.  I'm running 3.5.

    I am also noticing the Telerik.Webcontrols namespace.  There is a squiqqly line under this namespace.  How do I get this namespace to be recognized?  

    Sincerely,
    R2 
  6. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 16 Jan 2009 Link to this post

    Hi R2,

    I am afraid I am not completely sure what lesson you mean - I assume that you meant the page 459 of our online tutorial here but on this page there is a lesson for the RadTreeView control and not for the RadGrid.

    About the namespaces - Telerik.WebControls is the namespace which is used with RadControls for ASP.NET and Telerik.Web.UI is the one which is used for RadControls for ASP.NET AJAX. Since I do not know what dll files you have in your Bin folder and how is your project configured I cannot tell what to do to solve the issue with the unrecognized namespace.

    I think that the best way to proceed is that you prepare a sample, fully runnable demo which reproduces the problem, open a new support ticket and send it to us along with detailed explanation. Once we receive it, we will have a better understanding on your configuration and the issue and we will help you resolve the problem.

    Greetings,
    Svetlina
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017