A lot has happened since the last time I updated this site. New Years resolution will definitely be to create a new portfolio website.

The reason for this post however is to let you know about a new service I have launched providing premium themes and starter kits for Umbraco. Check out the site at

Came across this issue today for a LinkButton I was using inside a repeater control which was inside an UpdatePanel. It turns out that a LinkButton does not automatically cause partial page rendering in this situation. To solve this issue you need to register the LinkButton inside the Repeater for Asynchronous Postback.

rptSearchList.DataSource = loPagedDataSource;

//Initialize link button for ajax
foreach (RepeaterItem loItem in rptSearchList.Items){
   if (loItem.ItemType == ListItemType.Item || loItem.ItemType == ListItemType.AlternatingItem){
      LinkButton lbFavourites = (LinkButton)loItem.FindControl("lbFavourites");
       ScriptManager ScriptManager1 = (ScriptManager)FindControlRecursive(this.Page, "ScriptManager1");

The above code first finds the LinkButton based on its ID within the repeater control. In my example I have added one further step as my Repeater was part of a UserControl sitting within a MasterPage. The MasterPage held the ScriptManager so I used a method for finding the ScriptManager from the user control. The below code is a useful method I used to find the ScriptManager.

public static Control FindControlRecursive(Control controlToStartFrom, string ctrlIdToFind){
   Control found = controlToStartFrom.FindControl(ctrlIdToFind);

   if (found != null)
      return found;

   foreach (Control innerCtrl in controlToStartFrom.Controls){
      found = FindControlRecursive(innerCtrl, ctrlIdToFind);

      if (found != null)
         return found;
   return null;

I have seen several posts around the web where people have created custom error handling code in the global.asax file. The problem a lot of developers seem to come across is obtaining the actual line number where the error occured.

The main issue I have seen is developers using the following code to obtain information on the error that has occured:

System.Exception myError = Server.GetLastError();

This is where they are going wrong. The above code gives information on the last error that has been recorded as the event bubbles up through the layers, and not the information that was recorded when the actual error occured. The following line of code will obtain the Exception object describing the original error:

System.Exception myError = Server.GetLasteError().GetBaseException();

When an error occurs in my applications I like to send an email to myself with the error information and also write to a log file located on the server. Below is an example of the code I use in the global.asax file to achieve this:

void Application_Error(object sender, EventArgs e) 
    // Code that runs when an unhandled error occurs
    if (System.Configuration.ConfigurationManager.AppSettings.Get("SYS_ERROR_LOG_ACTIVE") == "YES") {
        System.Exception myError = Server.GetLastError().GetBaseException();
        //Do not send email if error is page not found
        if (myError.Message.IndexOf("does not exist.") == -1)
             HttpContext con = HttpContext.Current;
             System.Diagnostics.StackTrace myStack = new System.Diagnostics.StackTrace(true);

             CreateLogFiles Err = new CreateLogFiles();
             Err.ErrorLog("Offending URL: " + con.Request.Url.ToString() + Environment.NewLine +
             "Source: " + myError.Source + Environment.NewLine +
             "Message: " + myError.Message + Environment.NewLine +
             "--- Full Error --- " + Environment.NewLine + myError.StackTrace.ToString());

             //Create MailDefinition

             System.Web.UI.WebControls.MailDefinition md = new MailDefinition();
             md.IsBodyHtml = false;

             System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage("SENDER EMAIL ADDRESS", "RECIPIENT EMAIL ADDRESS");
             msg.Subject = ConfigurationManager.AppSettings.Get("SYS_ADMIN_SITE_NAME") + "Error Details";
             msg.Body = "Offending URL: " + con.Request.Url.ToString() + Environment.NewLine +
             "Source: " + myError.Source + Environment.NewLine +
             "Message: " + myError.Message + Environment.NewLine +
             "--- Full Error --- " + Environment.NewLine + myError.StackTrace.ToString();

             System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();

If anyone has any questions on the use of this code, fire away.

Todays problem involved refreshing an image after uploading using a FileUpload control. The issue was that although the file was changing on the server, the file name was staying the same. This results in the browser displaying the old file as it is being retrieved by the browsers cache. To avoid this problem you need to add a unique querystring parameter to the image url. You can achieve this with the following code:

string lsTimeStamp = DateTime.Now.ToString("yyyyMMddhhmmss");
Image1.ImageUrl = lsImageName + "?ts=" + lsTimeStamp;

Tools I Use

Web development, custom web based business applications, CMS systems.
Custom CMS systems using the Umbraco open source CMS based on ASP.NET.
I use Wordpress for small to medium scale CMS systems.
Dreamweaver, Flash, Flex and Photoshop are my tools of choice for interface design.

Read more about my Skills »


The ramblings, thoughts and opinions expressed on this website are my own personal opinions and do not represent my employer's views or the views of any companies I have worked for in the past.

About me

Welcome to my portfolio website. My name is Marc Love and I am a Web Developer based in Glasgow, Scotland.

I have worked for some of the top digital agencies in Glasgow during my career and have recently started up my own digital agency, madebycrunch with my web designer colleague Paul Daly. Our aim is to design and develop cutting edge websites that make a significant difference to the success of your business.

We are currently working on a range of different projects that you will be able to see very soon on the new madebycrunch website.

This site contains a selection of the projects I have worked on throughout my career.

Feel free to visit my Blog or take a closer look at my Portfolio.

Also check out a new service I have launched (November 2014) providing premium Umbraco Themes and Starter Kits.

Get in touch!

If you are looking for freelance web developer or web designer services please get in touch via my contact page or the info below.

Tel: 0141 275 4848
Mob: 07795 417 980

St Georges Buildings
5 St Vincent Place
Glasgow, G1 2DH