Modify a Word 2007 Open XML document via C#
Interesting problem that I came across here…A client requested that their system was to have the ability to load in a Word 2007 Document, perform some text manipulation routines and save the document back to the server. Firstly, you can rename a docx document to docx.zip and you can extract all of the files in [...]
A CMS that integrates into ASP.NET MVC
Here is a open source CMS called N2 that provides a CMS framework to build web applications on using the ASP.NET MVC Model. Its a very basic CMS, but it provides all the core functionality including Pages, Articles and a .NET Permissions Model (it also has some add ons and allows developers to contribute their [...]
Decoupled Code using SubSonic
Subsonic is fantastic when generating a bunch of classes directly from the database structure…but the issue comes when OO/Application Objects clash with relational database structures. An idea is to use Subsonic to query the data from the database and map the data directly to a application/OO object. A really good example following the link below [...]
Best Coding Practices – TIP 3
The use of partial classes can help improve coding for the following reasons: As you can split code into seperate physical files, its easier to seperate UI and Business Logic that may belong in a single class Produces clean and organised code No performance hit… The compiler groups all partial classes into one entity during [...]
Using ContextMenuStrip and NotifyIcon classes with WPF
There are many ways to get a notification icon displaying in the system tray, this is how I managed to get it working using Windows Presentation Framework: public partial class ClassName : Window { private System.Windows.Forms.NotifyIcon m_notifyIcon; private System.Windows.Forms.ContextMenuStrip m_contextMenu; public ClassName() { InitializeComponent(); //Initalize the context menu strip m_contextMenu = new System.Windows.Forms.ContextMenuStrip(); System.Windows.Forms.ToolStripMenuItem mI1 [...]
Action(T) Generic Delegate
Very useful delegate to create anonymous functions…why? This is especially useful when you have repeated code within a function. This particular example gets a list of tables from a database based on a key that is consumed by the id parameter. The Action(T) delegate can have zero to several different parameter types. Action getTables(String id) [...]
Using the HttpWebRequest class
In this particular scenario I had to initiate a request from another website in code and track its response to be modified and rendered back to the user. I had a series of LinkButton html controls on the web form that consume one event. <asp:LinkButton id=”link1” runat=”server” onClick=”genericEvent”></asp:LinkButton> When the user clicks on a particular [...]
Using ASP.NET MVC on IIS6 or below
When you are building a web applicatio using the ASP.NET MVC framework on IIS7, it URL routing works smoothly and without any dramas. But when it comes to IIS6 you have to make a comprimse especially if you are developing web apps within a shared hosting envoirnment. I found the easist way is to change [...]
Creating a generic list of anonymous types
Scenerio I have a simple HTML form on a ASP.NET Web page. This form is to post a number of values including several elements that are compulsory to perform several actions on the server. As we know, when we post values to ASP.NET these are available for Request.Form. All we know is the key and [...]
Using Nested Functions in C#
Scenario We currently have a templating API system where this allows developers to use a combination of C# and HTML markup to customized the display of the client’s websites. In this case, I needed a way to quickly perform some calculations and formatting without having to declare the function at design-time. My problem was I [...]


