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

RadTooltipManager in a Sharepoint 2007 web part

4 Answers 69 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Dasha
Top achievements
Rank 1
Dasha asked on 12 Nov 2010, 07:25 PM
Hello,

I am working on a scheduler web part and have recently added the custom tooltip capability using the RadTooltipManager.  I have followed this demo pretty my to the t: http://demos.telerik.com/aspnet-ajax/scheduler/examples/radtooltip/defaultcs.aspx  It's working great in Sharepoint 2010, but when I add my web part to the Sharepoint 2007 environment, I get this nasty error and my page crashes:
"

The control with ID 'RadToolTipManager1RTMPanel' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

"

I know for a fact that Sharepoint web parts have a script manager on the page, and just in case we're checking for its existance in the OnInit event:

protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
  
            Page.ClientScript.RegisterStartupScript(typeof(Adapter20), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
            if (this.Page.Form != null)
            {
                string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
  
                if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
                    this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
            }
  
            // Register the ScriptManager
            ScriptManager scriptManager = ScriptManager.GetCurrent(Page);
            if (scriptManager == null)
            {
                scriptManager = new ScriptManager();
                scriptManager.ID = "CWScriptManager";
                scriptManager.EnablePartialRendering = true;
                Controls.AddAt(0, scriptManager);
            }
            //scriptManager.EnablePartialRendering = true;
            scriptManager.LoadScriptsBeforeUI = false;
        }

Due to procedure limitations we're currently forced to use the 2010.1.309.35 version of telerik controls.

Any ideas what could be going wrong?

4 Answers, 1 is accepted

Sort by
0
Dasha
Top achievements
Rank 1
answered on 12 Nov 2010, 11:29 PM
I was able to resolve the issue with the page exploding by adding the RadTooltipManager to the control dynamically in CreateChildControls.  That works for me.

However, now I'm seeing a different issue.  When I hover over the appointments, instead of seeing the tooltip, the page does a postback.  I believe this is related to this issue:http://www.telerik.com/community/forums/aspnet-ajax/scheduler/asp-updatepanel-and-radscheduler-issues.aspx (see latest entries). Basically the scheduler is having a tough time with ajax callbacks in a Sharepoint 2007 environment, and I have not been able to figure out why.
0
Dasha
Top achievements
Rank 1
answered on 12 Nov 2010, 11:30 PM
0
Accepted
T. Tsonev
Telerik team
answered on 16 Nov 2010, 09:28 AM
Hello Dasha,

Thank you for the detailed problem description and for sending a live URL.

I also think that both issues are related and they have to do with the specific life-cycle of the web part. We should try to create the child controls immediately after the OnInit method executes:

protected override void OnInit(EventArgs e)
{
    base.OnInit(e);
 
    Page.ClientScript.RegisterStartupScript(typeof(Adapter20), this.ID, "_spOriginalFormAction = document.forms[0].action;_spSuppressFormOnSubmitWrapper=true;", true);
    if (this.Page.Form != null)
    {
        string formOnSubmitAtt = this.Page.Form.Attributes["onsubmit"];
 
        if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
            this.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
    }
 
    EnsureScriptManager();
    EnsureChildControls();
}
 
private ScriptManager EnsureScriptManager()
{
    ScriptManager sm = ScriptManager.GetCurrent(Page);
    if (sm == null)
    {
        if (Page.Form != null)
        {
            sm = new ScriptManager();
            sm.ID = Page.Form.ID + "_ScriptManager";
            Page.Form.Controls.Add(sm);
        }
    }
 
    return sm;
}

Note that I'm adding the ScriptManager to the Form instead to the Controls collection. This is the correct approach and should help.

Please try this and let me know if this helps.

Regards,
Tsvetomir Tsonev
the Telerik team
Browse the vast support resources we have to jumpstart 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.
0
Dasha
Top achievements
Rank 1
answered on 16 Nov 2010, 04:59 PM
Oh man, I think that finally did it!

Thank you so much for the help!  Let's hope it's the last of it :)
Tags
Scheduler
Asked by
Dasha
Top achievements
Rank 1
Answers by
Dasha
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or