private void AddAttribute(AttributeCollection a, string eventName, string imageUrl) { try { a.Remove(eventName); } finally { a.Add(eventName, "this.src='" + imageUrl + "'"); } }