Bing Map Widget

Posted by Community Admin on 05-Aug-2018 14:03

Bing Map Widget

All Replies

Posted by Community Admin on 30-Mar-2012 00:00

How would I go about copying the Bing Map Widget in to SF5.0 from the SDK?

I tried to simple copy the files, setup the toolbox and drag and drop but it doesnt show. I eventually want to edit the map so it shows multiple pins and gets the data it requires from a module I have created but one step at a time. Just want to get a BingMap on my site just now.

Thanks,
Owain.

Posted by Community Admin on 30-Mar-2012 00:00

to include the bings widget you can either include the dll from the project bin folder or import the entire project itself into your solution. If you do that be sure you include a reference to that project in your website.

Finally be sure to include the control in your configuration, either by registering it in the toolbox or with something like this in your toolboxConfig file

<add enabled="True" type="Sitefinity.Widgets.Maps.Bing.BingMapWidget, Sitefinity.Widgets.Maps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" title="Bing Map Widget" description="Bing Map Widget" visibilityMode="None" name="Bing Map Widget" />

Hope this is helpful, let me know if you if you encounter issues!

Posted by Community Admin on 02-Apr-2012 00:00

I would prefer to import the entire project into my solution, are there instructions on how to do this. I tried just importing in Visual Studio but it doesnt seem to have worked. Sorry if this is a really simple question - been out of development for about a year so a bit rusty!!

Thanks

Posted by Community Admin on 02-Apr-2012 00:00

copied the .dll in to my site but now I get the error:
Could not load file or assembly 'Telerik.Sitefinity, Version=4.4.2117.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x080131040)

Im guessing this is because I am running Sitefinity5 and the SDK example is 4.4?

Posted by Community Admin on 02-Apr-2012 00:00

Ive managed to get the solution in to my project but now I get a message:
"Loading Map (Requres Javascript) . . ."
Once I drag the widget in to my template.

Any help would be great.
O.

Posted by Community Admin on 02-Apr-2012 00:00

Owain,

I'm glad you got the project loaded. The Sitefinity SDK has been updated to match the latest release of Sitefinity 5, so I do encourage you to update it so that the examples will be compatible with the latest version.

You can also copy the project into your solution or "add existing project" to select the csproj for the sample. Just be sure to update the Telerik.Sitefinity reference to the one in your website so the versions match.

As for the error you are getting, it might be a problem with the embedded resources. Do you have Firebug for firefox or Chrome Developer Tools? These are helpful for debugging issues. If you can identify any error messages I can try to help you resolve them.

hope this is helpful!

Posted by Community Admin on 03-Apr-2012 00:00

Thanks, I have installed Firebug and annoyingly there arent any errors. I may have setup the Toolbox incorrectly though.
In the Control CLR Type of Virtual path field I have :
~/Sitefinity.Widgets.Maps/Bing/Map/BingMapWidget.ascx

Which is the location fo the maps widget however, when I click on Edit it doesnt load the Designer screen I see in the SDK. Im currently downloading the SDK 5.0 again as I did think it was strange that I was getting version 4.4 errors.

Once I have copied the files over again I will post back any results.

Posted by Community Admin on 03-Apr-2012 00:00

In that case it is most likely the LayoutTemplatePath that needs to be updated. If you moved the project files into your website solution (as opposed to keeping it a separate project) you need to change the LayoutTemplatePath property for both the Widget as well as the control designer.

In the SDK they are embedded resources, so they use the Virtual Path Provider to map to the embedded template. You should modify the path so that instead of this:

/// <summary>
 /// Gets or sets the path of the external template to be used by the control.
 /// </summary>
 /// <value></value>
 public override string LayoutTemplatePath
 
     get
     
         return Resources.VirtualPathPrefix + "Sitefinity.Widgets.Maps.Bing.Map.BingMapWidget.ascx";
     
     set
     
         base.LayoutTemplatePath = value;
     
 

you have something like this:
/// <summary>
 /// Gets or sets the path of the external template to be used by the control.
 /// </summary>
 /// <value></value>
 public override string LayoutTemplatePath
 
     get
     
         return "~/SitefinityWidgets/Maps/Bing/Map/BingMapWidget.ascx";
     
     set
     
         base.LayoutTemplatePath = value;
     
 

where that return string points to the physical relative path of the template file.

I hope this makes sense and is helpful!

Posted by Community Admin on 03-Apr-2012 00:00

So, would this mean I wouldnt need the .dll either?
I've been working on this all day and I am slowly understanding how Sitefinity ticks, so if nothing else by doing this, I have learnt more! :)
I will give your suggestion a go and see how it goes. Thanks again!

Posted by Community Admin on 03-Apr-2012 00:00

correct, by moving the project files into the website project itself, you no longer need the dll because it's now part of the website solution, so you can reference it as a User Control (.ascx) directly instead of a Compiled Dll control.

If you updated the SDK and compiled the DLL for your version, you could copy the dll only, add the reference, and be done, since the DLL has everything the widget needs to run.

Moving the project files into the website lets you always have it match the SF version because it's now permanently part of the project.

I hope that makes sense, please let me know if I can be of any further help.

Posted by Community Admin on 03-Apr-2012 00:00

I feel we are almost there!
When I drag the widget it to my page is still says "Loading Map (requres Javascript)..." but when I click on Edit, it just shows me a basic Edit screen, not the edit screen to enter in town, city, address etc. Its as if it can't locate the .js or the designer template. I have double checked the paths but I guess I may have missed something in one of the .cs files.

Posted by Community Admin on 03-Apr-2012 00:00

it might be the namespaces. If you recreated the widget files the namespaces may be different. Look at the Designer.js file, it should have a bunch of namespaces that need to match the ones for the widget classes.

For more information on how this works, I encourage you to read through the Widget blog posts to get familiar with how it all wires up together. I'm sure it will make much more sense:

“Hello World” guide to custom Sitefinity Widgets & ControlDesigners
Anatomy of a Sitefinity 4 Widget

Posted by Community Admin on 05-Apr-2012 00:00

Thanks for all your help. I ended up starting from scratch and just putting in small bits of code at a time. The annoying thing is, when it says "Loading Map (Requres Javascript) . . ." it is actually working, it just can't load the javascript until the page is loaded, which is obviously isnt doing when you first drag the widget on to the page!

Hopefully everything will work from here on in.

Thanks again.

This thread is closed