ScriptManager Error

Jul 8, 2009 at 4:38 PM

This looks like a great package, but I received an error message when I tried to use it: The DocType saved just fine, but when I went to a node to add the content, I got a server error:

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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The control with ID 'PageVideoLink' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

 

I am using umbraco v 4.0.2.1 (Assembly version: 1.0.3441.17657).

Do you have any thoughts about this?

Thanks!

Heather

Jul 23, 2009 at 11:51 AM

I also had same issue, i have downloaded code and done a few updates basically replaced the updatepanel with a panel and it now works, guess i lose the ajax update but on save of item the video appears.  heather if you want updated version drop me a mail ill get it to you. 

 

Rasmus my updates look like

 

using System;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Designit.Umb.DataTypes.Video
{
    public class DataEditor : System.Web.UI.WebControls.Panel, umbraco.interfaces.IDataEditor
    {
        private readonly umbraco.interfaces.IData data;
        private TextBox embeddedVideoUrl;
        private Literal embeddedVideoPreview;
        private string divId;

        public DataEditor(umbraco.interfaces.IData Data)
        {
            data = Data;
        }

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            umbraco.library.AddJquery();

            embeddedVideoUrl = new TextBox();
            embeddedVideoPreview = new Literal();
            divId = Guid.NewGuid().ToString();

            if (data != null && !string.IsNullOrEmpty(data.Value.ToString()))
            {
                embeddedVideoUrl.Text = data.Value.ToString();
                embeddedVideoPreview.Text =
                    string.Format("<div id=\"{0}\"></div>", divId);
            }
            else
            {
                embeddedVideoUrl.Text = string.Empty;
                embeddedVideoPreview.Text = string.Format("<div id=\"{0}\" style=\"display:none;\">&nbsp;</div>", divId);
            }

            embeddedVideoUrl.TextMode = TextBoxMode.SingleLine;
            embeddedVideoUrl.CssClass = "umbEditorTextField";
            embeddedVideoUrl.Attributes.Add("onchange", "previewVideo(this, '" + divId + "')");

            this.Controls.Add(embeddedVideoUrl);
            this.Controls.Add(new LiteralControl("<br /><br />"));
            this.Controls.Add(embeddedVideoPreview);
            this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "EmbeddedVideo", EmbedVideo());
           
        }

        public System.Web.UI.Control Editor
        {
            get { return this; }
        }

        public void Save()
        {
            data.Value = embeddedVideoUrl.Text;
        }

        public bool ShowLabel
        {
            get { return true; }
        }

        public bool TreatAsRichTextEditor
        {
            get { return false; }
        }

        public string EmbedVideo()
        {
            var sb = new StringBuilder();
            sb.AppendLine("<script type=\"text/javascript\">");

            sb.AppendLine("$(document).ready(function () {");
            sb.AppendLine("  previewVideo(document.getElementById(\"" + embeddedVideoUrl.ClientID + "\"), \"" + divId + "\");");
            sb.AppendLine("});");
            
            sb.AppendLine("function getVideoLink(v) {");
            sb.AppendLine("  // YouTube");
            sb.AppendLine("  if (v.match(/watch\\?v=(.+)(.*)/)) {");
            sb.AppendLine("    return 'http://www.youtube.com/v/' + v.replace(/^[^v]+v.(.{11}).*/,'$1\');");
            sb.AppendLine("  }");
            sb.AppendLine("  // Vimeo");
            sb.AppendLine(@"  if ( v.match(/^http:\/\/(?:www\.){0,1}vimeo\.com\/(\d+)$/) ) {");
            sb.AppendLine(@"    return 'http://vimeo.com/moogaloop.swf?clip_id=' + v.match(/^http:\/\/(?:www\.){0,1}vimeo\.com\/(\d+)$/)[1];");
            sb.AppendLine("  }");
            sb.AppendLine("  // Google video");
            sb.AppendLine("  if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) {");
            sb.AppendLine("    return 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en';");
            sb.AppendLine("  }");
            sb.AppendLine("}");

            sb.AppendLine("function previewVideo(obj, divId){");
            sb.AppendLine("var objValue = obj.value;");
            sb.AppendLine("$('#' + divId).css('display', 'block');");
            sb.AppendLine("var url = getVideoLink(objValue);");
            sb.AppendLine("var embedCode = '<object width=\"320\" height=\"240\"><param name=\"movie\" value=\"' + url + '\"></param><param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param><embed src=\"' + url + '\" type=\"application/x-shockwave-flash\" allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"320\" height=\"240\"></embed></object>';");
            sb.AppendLine("$('#' + divId).html(embedCode);");
            sb.AppendLine("}");

            sb.AppendLine("</script>");
            
            return sb.ToString();

        }
      
    }
}

Jul 23, 2009 at 4:23 PM

Thanks, Ismail, That would be great. You can email me, or upload it somewhere... heather .at. floydinnovations .dot. com :-)

Aug 4, 2009 at 11:37 AM

Hey all,

Sorry to reopen the thread but i have had the exact same problem! How can I fix this?

 

Cheers

Alec

Aug 4, 2009 at 1:08 PM

Try to put this in at the top of your page:

 <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

Aug 4, 2009 at 1:53 PM

Im afriad that hasnt worked, im still getting the same error. Would i need a script manager called "ScriptManager1" or is it already installed?

 

Cheers

Alec

Aug 4, 2009 at 2:16 PM

SciptManager is a part of ASP.NET AJAX Extensions (Isn't this a prerequisite for Umbraco?)

You can download it from here: http://www.asp.net/ajax/

Aug 4, 2009 at 2:21 PM

Im pretty sure it is but it didnt work and I dont remember installing it... We shall see...

Aug 4, 2009 at 2:37 PM

Ok i have it installed, i think im running version 3.5. I'm sorry im not overly sure what to be doing! Thanks for the help.

Aug 5, 2009 at 9:20 AM

The Problem is persisting, However i should have pointed out this is occuring in the content section when looking at a node that uses the data type. Again apologies for causing trouble, I'm still fairly new to all of this

Aug 10, 2009 at 11:42 AM

Guys,

You can get my hacked version here http://www.box.net/shared/a2qx7xuine without the ajax stuff.

Regards


Ismail

Aug 10, 2009 at 11:51 AM

Thanks Ismail

Nov 23, 2009 at 10:06 PM

I also have the same script error. The patch from ismail solves the problem. Can this be included in the next version of the control?

(it is also mixing up with and height, see other post)

Nov 24, 2009 at 12:01 PM

I'll have a look at it today and get the height, width corrected and remove the use of updatepanel.

Nov 24, 2009 at 12:51 PM
Edited Nov 24, 2009 at 12:58 PM

Download the patch (dll) from the release 1.0.1 and see if that doesn't help

Jun 30, 2010 at 6:02 AM

i installed video embed package and i successfully added and i am able to saw preview while i added video url on video tab but while i trying to open that page i got error like

Error parsing XSLT file: \xslt\Designit.VideoEmbed/VideoEmbed.xslt

please help me out i sutck up here from past 2 days need urgent solution