Need Help with Silverlight (Book Widget) in RC2 - General Discussions - General Discussions - Progress Community
 General Discussions

Need Help with Silverlight (Book Widget) in RC2

  • Need Help with Silverlight (Book Widget) in RC2
  • Hello,

    I am having trouble getting the Book Widget to work in the web app sample that came with the RC2 download.  I am new to Sitefinity and slowly finding my way, but have gotten stuck here.  When I navigate to the Book Widget an error is thrown on this line of code:

    slCtl.Content.mainPage.SetBookProperties(Sys.Serialization.JavaScriptSerializer.deserialize(this.get_properties().toJSON()));

    The error is:
    Line: 7412
    Error: Object doesn't support this property or method

    The following message appears in the browser above the widget:
    You must have installed Silverlight 4.0 SDK.

    The widget is there, but does not work.  The "You must have installed Silverlight 4.0 SDK" message also appears when I navigate to the Cover Flow widget, but that one works.

    This information is also shown in the integrated debugger:
      Object doesn't support this property or method  Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl01_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d4.0.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f68db6e-ab92-4c56-8744-13e09bf43565%3aea597d4b%3ab25378d2%3bTelerik.Sitefinity.Resources%3aen-US%3a110590a8-1007-4236-953e-f68c83688736%3a5fd29111%3a7ee0bb1f%3a83eb063b%3a64dcfe0a%3a1154458f%3a2232f901%3a24e33f3%3bTelerik.Sitefinity%3aen-US%3add66d247-ba3e-4019-8322-2a9066e7bd83%3a993d8e92%3a5b182b17%3bTelerik.Web.UI%2c+Version%3d2010.3.1109.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a6955197e-6bcc-48a0-9bff-1fd043726dc6%3a16e4e7cd%3af7645509%3a24ee1bba%3ae330518b%3a1e771326%3a8e6f0d33%3bBookWidget%3aen-US%3a5ba01476-b282-4d2c-a328-3dfff648cffa%3a18ab6406, line 7412 character 9

    I have carefully checked and reinstalled both Silverlight 4 and its SDK.  I am using VS 2010 on Windows 7.

    Thanks for  your time.
  • Hello Steven,

    Thank you for contacting Telerik Support.

    The has been a bug with this control which has been fixed now. Can you please go to the BookWidget project -> Resources -> Book.js file and edit the bellow function:
    was:
    pluginLoaded: function (sender, args)
        var imagesArr = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_imagesCollection());
        slCtl = sender.getHost();
        for (idx in imagesArr)
            slCtl.Content.mainPage.SetItem(imagesArr[idx]['Url']);
        
        slCtl.Content.mainPage.SetBookProperties(Sys.Serialization.JavaScriptSerializer.deserialize(this.get_properties().toJSON()));

    should be:
    pluginLoaded: function (sender, args)
        var imagesArr = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_imagesCollection());
        slCtl = sender.getHost();
        for(var idx = 0; idx<imagesArr.length; idx++)
            slCtl.Content.mainPage.SetItem(imagesArr[idx]['Url']);
        
        slCtl.Content.mainPage.SetBookProperties(Sys.Serialization.JavaScriptSerializer.deserialize(this.get_properties().toJSON()));

    Then build the project again and clear your browser cache. The problem should be resolved.

    Regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Thanks very much for the reply.  I tried the recommended edit in the Book.js file, but it did not work for me.  I rebuilt the entire solution, cleared the browser cace and then repeated this after 'cleaning' the solution, but the same error showed up.  Do you have any further suggestions?

    Thanks.
  • Hello Steven,

    Please try inspecting the script files loaded by the page. Check if the old scripts are loaded or the new ones. I am not able to reproduce the error with proposed changes.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi,

    As best as I can tell, the modified file is loaded.  Here is a snippet of what I believe is the relevant code:

    // ------------------------------------------------------------------------ 
        // public functions 
        // ------------------------------------------------------------------------ 
        pluginLoaded: function (sender, args)
            var imagesArr = Sys.Serialization.JavaScriptSerializer.deserialize(this.get_imagesCollection());
            slCtl = sender.getHost();
            //for (idx in imagesArr)
                //slCtl.Content.mainPage.SetItem(imagesArr[idx]['Url']);
            //
            for (var idx = 0; idx < imagesArr.length; idx++)
                slCtl.Content.mainPage.SetItem(imagesArr[idx]['Url']);
            
            slCtl.Content.mainPage.SetBookProperties(Sys.Serialization.JavaScriptSerializer.deserialize(this.get_properties().toJSON()));
        ,


    That was obtained from the debugger of VS, so it is what got loaded.  Can you see if I got the modication right?

    Thanks, Steven
  • Hello Steven,

    Can you please put a breakpoint in the last line of this JavaScript method and see if any of the locals will return undefined?

    Regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • OK, I did that.  'args' returns undefined.
  • Hello Steven,

    The args is not used in the method so it should not be relevant. Can you see if slCtl.Content.mainPage.SetBookProperties is undefined or if any of the parameters passed is?

    Regards,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Thanks for your continued attention to the problem I am facing.  Although I have significant programming experience, I have just recently entered the .NET and Visual Studio world.  I have the assignment of evaluating Sitefinity for our agency and seemed to have jumped into the deep end.  That's OK, I say it only by way of explaining my answer to your question.

    As best as I can tell, there are no undefined variables in the 'locals' window .  I can set slCtl as a 'watch' and drill through it.  Also as best as I can tell, there are no undefined parameters.

    However, I am wondering if my lack of experience with the debugger is keeping me from seeing the obvious.  If you can tell me specifically how to get the information you need, I will be happy to do that.
     

  • Hi Steven,

    Is it possible that you have changed any of the properties of the book widget on the page? For example provided a property value which is not supported?

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • I certainly did not change anything deliberately, merely loaded the web app into VS and tried to run it.  If I changed something by accident that might be rather difficult to pin down.

    Is there a way I can download the web app and start fresh without reinstalling Sitefinity itself? 
  • Hi Steven,

    You can download only the Project Manager which you can use to create new projects. However this will not provide you with the the new source code of the samples. You can try this with the new release from today, where the initial issue is fixed.

    Best wishes,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  • Hi,

    please take a look at this line:
    this.get_properties().toJSON()

    when viewing this.get_properties() in the watch window, there is no toJSON() function.

  • 243431_toJSON.png
    Hello Steven,

    The toJSON() method is coming from the framework. You can find it documented here. This method converts the passed object to JSON format so that it can be communicated to the Silverlight control. You can see the attached image for its return when executed in the console.

    Greetings,
    Radoslav Georgiev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items