Ben Griswold on December 18th, 2008

jTemplates is a jQuery plugin and template engine for Javascript.  If you keep up with Dave Ward and/or Rick Strahl you may already be familiar with jTemplates as they have both highlighted the plugin on their respective bolgs.  About 1.5 months ago, however, I got into the action and started using jTemplates in conjunction with [...]

Continue reading about jTemplates with jQuery, AJAX and Json

Ben Griswold on December 16th, 2008

As javascript libraries, particularly jQuery, increase in popularity so do web techniques using AJAX and JSON. Have you ever seen this code?  It is front and back of an ASPX file with the single responsibility to return JSON data per an AJAX request. GetDataPage.aspx <%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”GetDataPage.aspx.cs” Inherits=”GetDataPage” %> <%– This minimal code [...]

Continue reading about HTTPHandler with JSON Data

Ben Griswold on December 12th, 2008

The Cache Helper Class has been updated so that it is no longer limited by the generic constraint.  The original post has been updated along with a sample project for download.  Let me know what think.  I know I’m much happy with this solution.  As always, thanks for your comments and thanks for letting me [...]

Continue reading about C# Cache Helper Class Revisited

Ben Griswold on December 10th, 2008

Do you need a quick and cache wrapper class? Here’s a static class which I included in my more recent C# web application.  You’ll notice the class uses generics to allow for some, umm, generic functionality.  public static class CacheHelper { /// <summary> /// Insert value into the cache using /// appropriate name/value pairs /// [...]

Continue reading about C# Cache Helper Class

Ben Griswold on November 12th, 2008

Many of my C# methods include what is referred to as a guard clause.  It isn’t a complicated concept.  Simply the first few statements of a routine validates passed-in parameters and/or state of the object and immediately returns an error or gracefully exits to the function is constraints aren’t met.  If I’m not mistaken, this [...]

Continue reading about Guarding Against Multiple Empty Strings

Ben Griswold on July 25th, 2008

There’s a ton of information online about exporting a DataGrid or GridView to Excel, but most variations do not consider the GridView may reside within an UpdatePanel.  It goes without saying, but I was disappointed when I recently dusted off my “Export GridView to Excel” code snippet and encountered a number of exceptions.  So I [...]

Continue reading about Export GridView to Excel within an UpdatePanel

Ben Griswold on July 3rd, 2008

I have collected a reasonably good size library of C# helper files over the years.  The EncryptionHelper below is one of many which I plan to share. using System; using System.Security.Cryptography; using System.Text; namespace Common { public static class EncryptionHelper { private const string cryptoKey = “cryptoKey”; // The Initialization Vector for the DES encryption [...]

Continue reading about C# Encryption / Decryption Helper Class

Ben Griswold on July 1st, 2008

In the same vein as my last post on how to programmatically update a service startup type, here’s how one might determine if a service is currently stopped in C#: using System.Management; /// <summary> /// This routine checks if the provided service is stopped. /// </summary> /// <param name=”serviceName”>Name of the service to be checked</param> [...]

Continue reading about Check Status of Windows Service