The List in C#
The first entry in my Code Review is the List<>. So far, the List is my favorite sort of array in C#. It has the benefits of being obvious in naming you do not have to know the size when it is declared – the List can expand or contract as needed adding items to […]
How To Fix Column Doubling in an ASP.net GridView – with Code Sample
The Problem: You are trying to create an ASP.net GridView that automatically populates on any dataset, as well as automatically sorts, but for some reason whenever you click the headers to sort the GridView, the data doubles. The Cause: I originally omitted crucial line gv.Columns.Clear(); in the code sample below. For whatever reason I […]
CSS trick – how to use two classes on a single DOM object
I have no idea how this trick has eluded me for so long, but it is possible to use two classes on the same DOM object. For example to combine a class called “TopNav” and a class called “SelectedNav” all you have to do is call them both with code like this <div id=”HomeNavItem” class=”TopNav […]
A simple way to create a Microsoft Word document from a template in Asp.net/C#
I recently had the need to create a Microsoft Word document from a template. I initially tried using Office Web Components and Interop but all that really wasn’t worth the trouble. I wound up doing global replacements in the html of html Here is how I did it: Open up your template document in […]
How to set up the CheckBoxList control in Asp.net
I recently came up with the need to have a validated CheckBoxList in and Asp.net page. Over the years I’ve come up with a standard way of setting up validated CheckBoxLists, so I thought I would share the method and start the brand new “Code Samples” section.. The aspx code is as follows <strong>Section Name</strong> […]