Hi. I am new to Umbraco and am attempting to set up the store locator package.
I seem to have set up everything and am getting the following message on my page, "Please provide a search term"
I see in the post about the package (http://www.nibble.be/), that a search location can be added via a query string, but can't figure out exactly where I should be coming up with what this query string should be and where I should add that in.
I have tried a number of options and keep getting the following error:
Error loading Razor Script Locator.cshtml Cannot perform runtime binding on a null reference
Hello! I seem to be having a similar problem and am unable to get working results.
Here's what I've done to set it up:
I installed the .zip package from the project page.
I added a property called "coordinates" of the data type "Google Map" to my Document type called "Location"
I setup the coordinates in each of my "Location" nodes.
I inserted the Locator Macro using the following code <umbraco:Macro DocTypeAlias="Location" LocationPropAlias="coordinates" UnitInMiles="1" NumberOfResults="500" Alias="Locator" runat="server"></umbraco:Macro>
Up to this point, when navigating to my page, which is formed similar to the following, I get the text "Please provide a search term" output where I placed the macro: http://www.mywebsite.net/about/branchesoffices/
Then I tried a few of the following querystrings... none seemed to work. All got the error "input string was not in the correct format"
I have installed the Locator package Razor edition and was not getting any results. Looking at the trace revealed a similar error to the one @Mike was getting
input string was not in the correct format
The error is occurring at line 48 where a Location object is created with the property's coordinates
Location itemLocation = new Location(
Convert.ToDouble(node.GetProperty(locationPropAlias).ToString().Split(',')[0], Utility.NumberFormatInfo),
Convert.ToDouble(node.GetProperty(locationPropAlias).ToString().Split(',')[1], Utility.NumberFormatInfo));
node.GetProperty(locationPropAlias).ToString() doesn't return the value of the property but the name of the property Type. So ToDouble throws a formatting error because it is not getting a number.
It will work if you change it use the value property
Cannot perform runtime binding on a null reference
problem and been working on it for the last day or so, finally solved the problem.
I had already created a load of Distributors under List of Distributors before I started playing around with the Locator and Google Maps packages, so I only set two of the distributors with Google Map coordinates. I kept on getting the error message until I filled in all the rest of the Distributors with test Google Maps coordinates and republished them all. If you add any new Distributors, the problem doesnt return...which is nice.
In my case, I've already got a heap of content that has locations stored using Darren Ferguson's Google Maps datatype. When I tried using this package, I got the error:
Error Loading Razor Script (file: Locator) Input string was not in a correct format. at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) at System.Double.Parse(String s, NumberStyles style, IFormatProvider provider) at CallSite.Target(Closure , CallSite , Type , Object , NumberFormatInfo ) at ASP._Page_macroScripts_Locator_cshtml.Execute() in c:\inetpub\blah.local\macroScripts\Locator.cshtml:line 48
I modified lines 42,43 & 44 of locator.cshtml to be:
Location itemLocation = new Location( Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[0], Utility.NumberFormatInfo), Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[1], Utility.NumberFormatInfo))
instead of:
Location itemLocation = new Location( Convert.ToDouble(node.GetProperty(locationPropAlias).ToString().Split(',')[0], Utility.NumberFormatInfo), Convert.ToDouble(node.GetProperty(locationPropAlias).ToString().Split(',')[1], Utility.NumberFormatInfo))
Note the Value.ToString()
It then worked perfectly. Thanks for a great package. Saved me a lot of time and mucking around.
Hi, im trying to use this package but having problem to set it up. The website http://www.nibble.be/?p=105 does not give enough instruction to set it up. I have no idea of where to store the long/late
I tried all the method bit still value not getting.please help below are the codes.
foreach (var node in nodesToSearchThrough) { Location itemLocation = new Location( Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[0], Utility.NumberFormatInfo), Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[1], Utility.NumberFormatInfo)); items.Add(new GeoItem(node,itemLocation,searchLocation.DistanceBetween(itemLocation,distanceunit))); still shows item count = 0 so no value displaying
Please provide a search term
Hi. I am new to Umbraco and am attempting to set up the store locator package.
I seem to have set up everything and am getting the following message on my page, "Please provide a search term"
I see in the post about the package (http://www.nibble.be/), that a search location can be added via a query string, but can't figure out exactly where I should be coming up with what this query string should be and where I should add that in.
I have tried a number of options and keep getting the following error:
Error loading Razor Script Locator.cshtml
Cannot perform runtime binding on a null reference
Any guidance will be appreciated.
Well I added a form that is appending my query string to the URL, but I am still getting this error when trying to run the query:
Error loading Razor Script Locator.cshtml
Cannot perform runtime binding on a null reference
(Also - We are using Umbraco 4.7.0) Thanks!
This is the form I am using:
<form method="get" action="locations.aspx">
<p>Find a location near you:</p>
<fieldset>
<label for="s">Address/postcode: </label>
<input type="text" name="s" />
<label for="s">Radius: </label>
<select name="radius">
<option value="0">Please select</option>
<option value="10">10 miles</option>
<option value="50">50 miles</option>
<option value="100">100 miles</option>
</select>
<button type="submit"><span>Go</span></button>
</fieldset>
</form>
Is this correct?
And are you using the default settings, or did you set the some params? Could you show the macro tag (placed on the template) ?
Hello! I seem to be having a similar problem and am unable to get working results.
Here's what I've done to set it up:
<umbraco:Macro DocTypeAlias="Location" LocationPropAlias="coordinates"
UnitInMiles="1" NumberOfResults="500" Alias="Locator"
runat="server"></umbraco:Macro>
I figured out what was going on for me.
Some of my coordinates in my Node Collection were not populated and returning a
I simploy put an if statement in the foreach to account for this:
foreach (var node in nodesToSearchThrough) {
string coordinates = node.GetProperty(locationPropAlias).Value;
if (coordinates != "")
{
Location itemLocation = new Location(
Convert.ToDouble(coordinates.Split(',')[0], Utility.NumberFormatInfo),
Convert.ToDouble(coordinates.Split(',')[1], Utility.NumberFormatInfo));
items.Add(new GeoItem(node, itemLocation, searchLocation.DistanceBetween(itemLocation, distanceunit)));
}
}
Now the following url will work on my site: http://www.mywebsite.net/about/branchesoffices/?s=21801
Hoping this might help someone else too.
I have installed the Locator package Razor edition and was not getting any results. Looking at the trace revealed a similar error to the one @Mike was getting
input string was not in the correct format
The error is occurring at line 48 where a Location object is created with the property's coordinates
i have the same problem, any ideas?
Hi Kalle
I think it will work if you change it to this
Hi,
I've been having the
Error loading Razor Script Locator.cshtml
Cannot perform runtime binding on a null reference
problem and been working on it for the last day or so, finally solved the problem.
I had already created a load of Distributors under List of Distributors before I started playing around with the Locator and Google Maps packages, so I only set two of the distributors with Google Map coordinates. I kept on getting the error message until I filled in all the rest of the Distributors with test Google Maps coordinates and republished them all. If you add any new Distributors, the problem doesnt return...which is nice.
Hope this saves someone a bit of time!
Peace out!
In my case, I've already got a heap of content that has locations stored using Darren Ferguson's Google Maps datatype. When I tried using this package, I got the error:
I modified lines 42,43 & 44 of locator.cshtml to be:
instead of:
Note the Value.ToString()
It then worked perfectly. Thanks for a great package. Saved me a lot of time and mucking around.
Hi, im trying to use this package but having problem to set it up. The website http://www.nibble.be/?p=105 does not give enough instruction to set it up. I have no idea of where to store the long/late
Please Help
Hi,
I tried all the method bit still value not getting.please help below are the codes.
foreach (var node in nodesToSearchThrough) {
Location itemLocation = new Location(
Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[0], Utility.NumberFormatInfo),
Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[1], Utility.NumberFormatInfo));
items.Add(new GeoItem(node,itemLocation,searchLocation.DistanceBetween(itemLocation,distanceunit)));
still shows item count = 0 so no value displaying
regards
mithun
Think the code needs an update will check
Well you need to provide a search by adding ?s=[location that I want to search for] to your querystring but that then ends up in
Error loading MacroEngine script (file: Locator.cshtml)
Looking into it
Of in the Locator.cshtml scripting file
look for this code
Location itemLocation = new Location(
Convert.ToDouble(node.GetProperty(locationPropAlias).ToString().Split(',')[0], Utility.NumberFormatInfo),
Convert.ToDouble(node.GetProperty(locationPropAlias).ToString().Split(',')[1], Utility.NumberFormatInfo));
and change to
Location itemLocation = new Location(
Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[0], Utility.NumberFormatInfo),
Convert.ToDouble(node.GetProperty(locationPropAlias).Value.ToString().Split(',')[1], Utility.NumberFormatInfo));
this is a version that tries to fetch the current user position:
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.