by Brad
9. June 2008 09:24
This post tells you how to take what I discussed in Part 1 and turn it into a custom EPiServer property, so CMS user's can simply enter a postcode and it will call of to Google's Local Search API, return the Coordinates for the postcode and plot a marker on the map. The user can then drag the marker for a more exact location, set the zoom level and finally the type of map (Normal, Satellite or Hybrid). The data is then rendered on the public site using the code from Part 1. The screenshot below show's how it will look in EPiServer (click the thumbnail for the full size version): Creating a...
[More]
by Brad
6. June 2008 15:17
Following on from my Google Analytics server control, I wanted make something "cooler", so creating a Server Control to render a Google Map control seemed ideal. Part 1 covers the creation of the this control, stay tuned for part 2 which will focus on creating a custom EPiServer property so it can be used in the EPiServer edit area, featuring Geocoding to lookup the coordinates from a UK post code, Map type selection and zoom level. Anyway here's the generic bit that can be used on any site... First off we need a set of basic properties to hold Latitude, Longitude, Zoom Level and Map Type: ...
[More]
by Brad
6. March 2008 11:44
If you want to write to the Server's Event log from ASP.NET you'll first need to tweak some security settings. The first change is easy, however the second took me a while to find. Step One: Grant "Full Control" to the "IIS_WPG" group to the following registry key: HKLM\SYSTEM\CurrentControlSet\Services\EventLog
Step Two:
One of the security restrictions added to IIS 6 under Windows Server 2003 was much tighter ACLs (Access Control Lists) on the event logs. This restricts what accounts can read and write to the logs (application, system & security). To overcome this you'll ne...
[More]
by Brad
31. January 2008 08:42
Its good practice to separate out code that can be re-used into its own class library which can easy be referenced by other projects. Until now any resources such as images/JavaScript files that I'd created I needed to remember to copy to each web site that used the dll, ensuring that I created the correct directory structure so the paths would be correct. Then it dawned on me that you must be able to embed these files into the dll itself. Here's the steps I used to embed an image file for a AjaxControlTookit Calendar Extender that I was using in a custom server control (the same principle can...
[More]
by Brad
23. January 2008 21:53
UpdatePanels work fine with almost all controls, one control that it does 'break' however is FileUpload. If you try and upload a file it will seem to work - but if you check FileUpload.HasFile it will always return false. Rubbish if you've got an UpdatePanel in your MasterPage! However there is a solution, in fact it's not the UpdatePanel that breaks it, but the asynchronous PostBack instead. So a neat trick is to register the button you're using to cause the upload to use a normal PostBack. This can be done as follows: this.ScriptManager.RegisterPostBackControl(btnUpload);
Then when ...
[More]
by Brad
16. January 2008 17:22
I've just spent a while pulling my hair out trying to find out why some text in my repeater control wasn't updating after postback on one page but was on another. The repeater was in a UserControl I'd made, and the same control was on both pages - the only difference - once was inside an AJAX UpdatePanel and on the other page it wasn't. Here's the offending code: <ItemTemplate>
<tr>
<td><asp:Image runat="server" ImageUrl='<%# Eval("Image") "%>' ID="iImage" /></td>
<td><%# Eval("Score") %></td>
<td>&l...
[More]
by Brad
14. January 2008 14:50
I've been using the .NET version of FCKeditor for some time, but recently changed the page layout, resulting in the FCKeditor instance now residing in an AJAX UpdatePanel. All was fine while using IE, but when I tested it in Firefox I noticed that the changed content in the FCKeditor wasn't getting saved to the database. It turns out its a JavaScript issue that effects Firefox and Safari. I've been unable to find the perfect solution but in the meantime I discovered the following code does the trick - but unfortunately causes Firefox/Safari users to see a full post back - not just what's i...
[More]