RadToolTip For Particular Node

10 posts, 0 answers
  1. Muhammad
    Muhammad avatar
    87 posts
    Member since:
    Oct 2012

    Posted 30 Dec 2010 Link to this post

    Hi,

    I am using RadToolTipManager for showing ToolTip for my RadTreeView Nodes. I want to show tooltip for my specific RadTreeView Node not for every Node. Is there anyway that I can achieve with some ajaxrequest so that I can hide my tooltip or show for that node which I would like to show.  Any help would be really appreciated.

    Protected Sub RadToolTipmanager_AjaxUpdate(ByVal sender As Object, ByVal e As ToolTipUpdateEventArgs)


            Dim roleName As String = e.Value
            Dim listOfUsersInToolTip As New RadListBox
            listOfUsersInToolTip.Width = 150
            listOfUsersInToolTip.Height = 200
            Dim usersList As ArrayList = rc.GetUserRolesByRoleName(DNN.GetPMB(Me).PortalId, roleName)
            If usersList.Count <> 0 Then
                For Each user As DotNetNuke.Entities.Users.UserRoleInfo In usersList
                    listOfUsersInToolTip.Items.Add(New RadListBoxItem(user.FullName, user.UserID))
                Next
                listOfUsersInToolTip.SortItems()
                e.UpdatePanel.ContentTemplateContainer.Controls.Add(listOfUsersInToolTip)
            Else


            End If




        End Sub
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 03 Jan 2011 Link to this post

    Hi Muhammad,

     I already answered your other thread and for your convenience and for others who might encounter the same issue, I pasted my reply below:

    Indeed, the RadTreeNodes do not have client IDs. However, you can either assign such on the server or create the tooltip dynamically on the client. For such cases we have prepared the following demo which shows both the approaches:

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

    If you want to tooltipify only particular nodes, you should add the only their ClientIDs (which you programmatically set) to the TargetControls collection or create dynamically tooltips only when they are hovered - in this manner the other nodes will not get tooltipified.

    Note, also, that if you have ajaxified the sorting, you should make sure that you also update the tooltip manager with AJAX when sorting.

    Please, examine the code and use it as a start point for your implementation.

    On a side note, when you install RadControls, our online examples projects are automatically installed on your computer and you can not only examine their full source code, but also extend them further in order to meet your requirements.

    You can open the demos from here:

    Start\Programs\Telerik\RadControls for ASPNET AJAX\Open Sample WebSite In VisualStudio

    The actual location on your hard disk is the following one:

    C:\Program Files\Telerik\RadControls for ASPNET AJAX \Live Demos

    I hope that this information is helpful, let me know if you have additional questions or you need further assistance.

    Greetings,
    Svetlina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Muhammad
    Muhammad avatar
    87 posts
    Member since:
    Oct 2012

    Posted 03 Jan 2011 Link to this post

    I am dynamically adding controls to my RadToolTipManager for my individual RadTreeNodes ... I am using RadListBox Control when I want to show items in my RadToolTip and a label when I just want to show a single line text message for my RadTreeNode. But I am getting this exception.

    Exception 

    System.Web.HttpException was unhandled by user code
      ErrorCode=-2147467259
      Message=Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
      Source=System.Web
      WebEventCode=0
      StackTrace:
           at System.Web.UI.Control.LoadViewStateRecursive(Object savedState)
           at System.Web.UI.Control.AddedControl(Control control, Int32 index)
           at System.Web.UI.ControlCollection.Add(Control child)
           at PS_UserJobMapping.RadToolTipmanager_AjaxUpdate(Object sender, ToolTipUpdateEventArgs e) in C:\inetpub\wwwroot\DNN\DesktopModules\phdcc.CodeModule\PS_UserJobMapping.ascx.vb:line 700
           at Telerik.Web.UI.RadToolTipManager.OnAjaxUpdate(ToolTipUpdateEventArgs e)
           at Telerik.Web.UI.RadToolTipManager.LoadClientState(Dictionary`2 clientState)
           at Telerik.Web.UI.RadWebControl.LoadPostData(String postDataKey, NameValueCollection postCollection)
           at Telerik.Web.UI.RadWebControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
           at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
           at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      InnerException: 

    Code 

    Protected Sub RadToolTipmanager_AjaxUpdate(ByVal sender As Object, ByVal e As ToolTipUpdateEventArgs)
    Dim roleName As String = e.Value
            Dim listOfUsersInToolTip As New RadListBox
            Dim label As New Label
            listOfUsersInToolTip.Width = 150
            listOfUsersInToolTip.Height = 200
            If IsUserRole(e.Value) Then
                Dim usersList As ArrayList = rc.GetUserRolesByRoleName(DNN.GetPMB(Me).PortalId, roleName)
                If usersList.Count <> 0 Then
                    For Each user As DotNetNuke.Entities.Users.UserRoleInfo In usersList
                        listOfUsersInToolTip.Items.Add(New RadListBoxItem(user.FullName, user.UserID))
                    Next
                    listOfUsersInToolTip.Sort = RadListBoxSort.Ascending
                    listOfUsersInToolTip.SortItems()
                    RadToolTipManager.Width = "150"
                    RadToolTipManager.Height = "200"
                    e.UpdatePanel.ContentTemplateContainer.Controls.Add(listOfUsersInToolTip)


                End If
            Else
                For Each role As RadComboBoxItem In cmbRoleName.Items
                    If FindUserInRole(role.Text, e.Value) Then
                        label.Text = e.Value & " belongs to " & role.Text
                        RadToolTipManager.Width = "160"
                        RadToolTipManager.Height = "50"


                        e.UpdatePanel.ContentTemplateContainer.Controls.Add(label)
                        Exit For
                    End If
                Next

            End If

  5. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 06 Jan 2011 Link to this post

    Hello Muhammad,

     As far as I can see from the code and the error you get a general ViewState error due to loading different control on postback/ajax request.

    If you add a control dynamically to a placeholder (update panel in this case)  (WebUserControl1.ascx) and on the next postback (ajax request) you add a different control  (WebUserControl2.ascx) to the same placeholder  ASP.NET tries to load the ViewState of the control contained previously at the placeholder -  it's expecting the previous control  you added :(WebUserControl1.ascx) but it will encounter another control instead  (WebUserControl2.ascx). That is why you get the ViewState problem.

    The easiest way to solve this problem is that you set EnableViewState="false" to the RadToolTipManager. The only side effect you can get is in case you set some property on the server and you do this once and not every time, e.g:

    if(!isPostBack)
    {
        RadToolTipManager1.Modal = true;
    }

    However, since this is not a very often case and you also do not do this in your code, I recommend to set
    EnableViewState="false" for the manager.

    Let me know whether this works for you.

    All the best,
    Svetlina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. Muhammad
    Muhammad avatar
    87 posts
    Member since:
    Oct 2012

    Posted 10 Jan 2011 Link to this post

    Thanking You for your reply.

    As you told me set EnableViewState="false" but now I am getting a new error.

    RadToolTipManager response error:
     Exception=Sys.WebForms.PageRequestManagerServerErrorException: An error has occurred because a control with id 'dnn$ctr426$View$ctl00$ctl01' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
  7. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 13 Jan 2011 Link to this post

    Hi Muhammad,

     I am not completely sure what causes the error but I assume that the problem comes from the fact that you do not set an ID to the control you add and thus it takes automatic ID which seems to be the same for different controls. That is why I suggest to set a unique, different ID to the control before you add it to the tooltip manager panel, e.g similar to this:

    listOfUsersInToolTip.ID = Guid.NewGuid().ToString()
    e.UpdatePanel.ContentTemplateContainer.Controls.Add(listOfUsersInToolTip)

    Best wishes,
    Svetlina
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  8. Neerajan
    Neerajan avatar
    10 posts
    Member since:
    Dec 2011

    Posted 15 Dec 2011 Link to this post

    Hello ,

    I am experiencing the same issue. Setting the EnableViewState="false" property is not working. In my case, for the very first time, the RadTooltipManager_AjaxRequest is called but for successive hovering the issue is displayed.

    Regards,
    Neerajan Lamsal
  9. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 19 Dec 2011 Link to this post

    Hi Neerajan,

    Have you tried providing IDs for the controls you add to the RadToolTipManager's update panel? If you need to reload the same user control instead of dynamically generating new instances so that your control can work with postbacks you could try using a static ID. If this does not help please open a support ticket and send us a simple, runnable page that shows your issue so we can help you better.


    Best wishes,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
  10. Neerajan
    Neerajan avatar
    10 posts
    Member since:
    Dec 2011

    Posted 20 Dec 2011 Link to this post

    Hi Marin,

    I have tried every single possible workaround but still getting same error. The code/logic I have implemented is much similar to code mentioned above. Today I tried to add label in front end and tried to change its text as follows:

    Protected Sub RadToolTipmanager_AjaxUpdate(ByVal sender As Object, ByVal e As ToolTipUpdateEventArgs)
    {
    label.EnableViewState= false;
    label.Text="Error";
    e.UpdatePanel.ContentTemplateContainer.Controls.Add(label);
    }

    My page is complex to post as it consists of lots of controls and logic. I'm using this control to display the validation Error message which varies upon selection of control. Thanks in advance.

    Regards,
    Neerajan
  11. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 20 Dec 2011 Link to this post

    Hi Neerajan,

    There is little more than guessing that I can do for now without being able to examine the issue. What I can suggest is that you create a new literal control each time and place your message there, something like:
    Protected Sub RadToolTipmanager_AjaxUpdate(ByVal sender As Object, ByVal e As ToolTipUpdateEventArgs)
     {
         Dim msg As String = "your message here, wherever it comes from"
         LiteralControl ltrlCtrl = new LiteralControl(msg)
         e.UpdatePanel.ContentTemplateContainer.Controls.Add(ltrlCtrl)
     }

    Your code sample also looks a bit odd and I am not sure how it would compile - a mix between VB.NET and C# would not allow you to run the page. Even if this is some issue with copying I still advise you examine your code for other errors that are masked by the AJAX (i.e. start debugging your page and see where exactly the error is thrown then try to resolve this situation).

    Greetings,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017