Creating and using snippets in Visual Studio 2008

0

Posted by Joe | Posted in Visual Studio 2008 | Posted on 04-02-2010

Visual Studio contains a number of predefined snippets. Snippets are usually available for common code that is used frequently allowing the developer to insert this code quickly without having to retype it every time. I often use the try and if snippets, but you can also create your own custom snippets. Recently I found myself to be endlessly creating a try/catch block where in the catch I was logging an exception using a custom logger class, so I decided to create a custom snippet to do this for me. In this post I’ll explain how to create a basic snippet, how to configure Visual Studio to use the snippet, and how to use it in code.

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Twitter

0

Posted by Joe | Posted in Personal | Posted on 18-01-2010

I decided to start a twitter account so if you feel like it you can follow me

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Force client-side JavaScript event to fire programatically using jQuery

0

Posted by Joe | Posted in JavaScript, jQuery | Posted on 15-01-2010

Earlier today I needed to force a clide side event to fire programatically using jQuery.

I found you can do this easily with the jQuery trigger method:

$("#myControl").trigger("change");

The above will trigger the change event of the control with ID ‘myControl’

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Edit in place / inline editing with jQuery, jTemplates and ASP.NET

0

Posted by Joe | Posted in ASP.NET, Ajax, JavaScript, jQuery | Posted on 12-01-2010

Download source

In this post I talked about how to use the jTemplates plugin for jQuery. Using my final example in the post I thought it would be cool to try and add some ‘edit in place’ functionality to the table.

For this to work I’ve created a Data Access Layer using Linq to XML. My web service then uses this DAL to save and retrieve my data.

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Linq to XML Tutorial

0

Posted by Joe | Posted in ASP.NET, C#, Linq, XML | Posted on 08-01-2010

Download source

This is an introduction to Linq to XML showing how to read, insert, update and delete from an XML file.

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Using the jTemplate jquery plugin with ajax and ASP.NET

0

Posted by Joe | Posted in ASP.NET, Ajax, JavaScript, jQuery | Posted on 05-01-2010

Download source

A guy in work introduced me to jTemplates, a template engine plugin for jQuery. It allows you to easily bind JavaScript objects to a defined template and also has some other nifty features.

I’ve found jTemplates to be particularly good when using ajax to display any information quickly and easily.

First I’ll explain how to create a simple template to display data, and then how to use the foreach and cycle features.

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Using jQuery to make ajax calls to an ASMX web service using ASP.NET

0

Posted by Joe | Posted in ASP.NET, Ajax, C#, JavaScript, jQuery | Posted on 04-01-2010

Download source

Making ajax calls to an ASP.NET web service using jQuery is too easy.  In this post I’ll explain how to do it!

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

Using jQuery’s Each method to iterate through a JavaScript array

0

Posted by Joe | Posted in JavaScript, jQuery | Posted on 30-12-2009

The Each method in jQuery is pretty useful and can be used to iterate through the elements within a jQuery object.

I’ve been using it recently to iterate through JavaScript arrays.  It saves having to use a for loop and the code looks nicer.

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

JSON Serialization using the DataContractJsonSerializer and C#

0

Posted by Joe | Posted in ASP.NET, C#, JavaScript | Posted on 29-12-2009

Download source code

Previously I’d done JSON serialization using the JavaScriptSerializer which is part of AJAX Extensions 1.0, but this is now obsolete.

.NET 3.5 introduced the DataContractJsonSerializer class.  The class sits in the System.Runtime.Serialization.Json namespace which is curiously hidden away in the System.ServiceModel.Web assembly.

The DataContractJsonSerializer can serialize a class that contains the Serializable attribute or any class defined as a DataContract.

Read the rest of this entry »

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit

JavaScript inline if statement

0

Posted by Joe | Posted in JavaScript | Posted on 29-12-2009

The JavaScript inline if statement is identical to the one in C#:

var forename = (gender == 'male') ? 'Joe' : 'Emily';

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to Reddit