Probleming RadToolTipManager and load new content

7 posts, 0 answers
  1. Anders
    Anders avatar
    20 posts
    Member since:
    Feb 2008

    Posted 16 Oct 2009 Link to this post

    HI.
    We have a number of buttons on the page that trigger the show of the Tooltip and the OnAjaxUpdate event server side.
    This has worked perfect for a year now using this code.

        protected void OnModalUpdate(object sender, ToolTipUpdateEventArgs e) {
          ControlInfo controlInfo = getControlInfo(e.Value);
          loadActivityControl(true, e.UpdatePanel, controlInfo);
        }

    But now we have gotten a new request from our users that they want to be able to go to another control from within one of the controls that reside in the UpdatePanel provided by the tooltip manager. I can not add more button id's to the

    TargetControls collection so i need to change the content of the updatepanel in another way. I tried this in my event that will trigger new content to be loaded into the updatepanel.. the member modalManager is the ToolTipManager (We use the tooltip as a popup (Modal) window)

        private void LoadModalControl(object sender, LoadModalControlEventArgs e)
        {
          modalManager.UpdatePanel.ContentTemplateContainer.Controls.Clear();
          loadActivityControl(true, modalManager.UpdatePanel, e.ControlInfo);
          modalManager.UpdatePanel.Update();
        }

    This works as far as the correct control loads and everything looks good, but if i do a postback now i get this error
    "Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_MainContent_ctl03_updatePanel'. If it is being updated dynamically then it must be inside another UpdatePanel"

    Best regards, Anders
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 21 Oct 2009 Link to this post

    Hi Anders,

    I prepared a sample demo page which implements the scenario you describe but unfortunately to no avail - everything is working as expected and no error is thrown. Would you please examine the attached demo page? In case its logic differs from yours, please modify it in ordre to reproduce teh issue and paste the full source code of teh demo page here. In case more modifications are needed, open a new support ticket and send us a fully runnabke reproduction demo along with detailed reproduction steps and explanations and we will debug it locally and we will do our best to help.

    Kind regards,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Anders
    Anders avatar
    20 posts
    Member since:
    Feb 2008

    Posted 21 Oct 2009 Link to this post

    Hi.
    I made a test app that demonstrates both my approaches.
    Approuach 1)
    In default.aspx I add my new target control to the targetcontrol collection
    I get the wrong old Value in the ToolTipUpdateEventArgs of the event handler.

    Approach 2) 
    In default2.aspx i add ad a postback event on the button and add my content to the updatepanel, this works but at postback it renders the orginal control, since it calls the OnUpdate event...

    It did not allow me to add zipfiles so im linking it
    http://agero.se/temp/TestWebApplication.zip

    Regards, Anders
  5. Anders
    Anders avatar
    20 posts
    Member since:
    Feb 2008

    Posted 26 Oct 2009 Link to this post

    Hi.
    Have you had time to test my test application? Our app is really dependent on this feature.

    Regards, Anders
  6. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 26 Oct 2009 Link to this post

    Hello Anders,
    We do not allow zip attachments in the forums in order to make sure that customers do not attach applications with developer DLLs here.

    Your first approach is not correct, because by adding the LinkButton as target control for the RadToolTipManager, you simply try to tooltipify that LinkButton. As a result, when you click the button, the manager tries to open another RadToolTip for this LinkButton. However, you cannot have two RadToolTips open at the same time and that is why the second tooltip does not open.

    Regarding your second approach - this approach is correct and the result you describe is expected. As you add the control to the RadToolTip dynamically, the RadToolTip should recreate this control on postback. Otherwise, after you click the LinkButton in the TestThree.ascx control, the RadToolTip will be empty. That applies to all dynamically added controls to the page - you yourself must make sure that you recreate those controls when their part of the page is updated.

    In case you still have problems with that, I would recommend that you first implement the behavior with a standard UpdatePanel control instead of a RadToolTip and then apply the same approach for the RadToolTip. In case you have problems with this, just send us your solution with an UpdatePanel and we will help you implement it with a RadToolTipManager.

    Sincerely yours,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Anders
    Anders avatar
    20 posts
    Member since:
    Feb 2008

    Posted 29 Oct 2009 Link to this post

    Can you please add the code needed for approach 2) to work?  The Value in the event arg is wrong so it will render old control, is it possible from code to set current value so that it will send correct value at next postback?

    /Anders
  8. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 03 Nov 2009 Link to this post

    Hi Anders,

    As Tsvetie already explained, the behavior you describe is not related to RadToolTipManager itself but to general ASP.NET knowledge. The Value in the EventArgs is teh corrcet one and it is the one which is set along with this target control. Furthermore, you never change this value so it is not expected that it should automatically change.

    This being said, I suggest to implement your scenario with a standard UpdatePanel control. Once you take care of recreating your controls in the update panel, simply replace it with the tooltip and in case you have problems with this, send us your solution with an UpdatePanel and we will replicate the very same behavior with the tooltip.

    I also recommend to examine the following article which explains how to deal with dynamically created controls in ASP.NET:

    http://couldbedone.blogspot.com/2007/06/dynamically-created-controls-in-aspnet.html

    Best wishes,
    Svetlina
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017