Format String with String.Format and C#
January 3rd, 2009
<%# String.Format("{0:#####-####}", Convert.ToInt32(Eval("ZipCode"))) %>
It is necessary to convert the ZipCode field to an integer in this instance because the Format class expects an integer to properly format a number, otherwise it will only return the string or value that you passed to the Format class.
I am using this in conjunction with the MaskedEditExtender, which removes [...]
Add a Count Column to Your Gridview, Datalist or Repeater
November 30th, 2008
Found this great article on how to add a counter column to your data rich controls.
http://www.lazyasscoder.com/AspNet/Article.aspx?id=55&title=How+To%3A+Add+a+row+count+column+to+a+GridView%2C+DataList+or+Repeater
The above article is specific to a GridView. Here is an example with a Repeater control.
<asp:Repeater ID="repeater" runat="server">
<ItemTemplate>
<%# Container.ItemIndex + 1 %>
<%# Eval("field_name") %>'>
</ItemTemplate>
</asp:Repeater>
Dreamweaver and Disappearing ASP.NET Directives
November 28th, 2008
If you are working with Dreamweaver templates and your ASP.NET directives keep disappearing try the following.
Place <%–’comment–%> on the second line after your page declaration on your content pages. You can leave your template as is.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="default" %>
<%--'comment--%>
You do not need to set the <!– TemplateInfo codeOutsideHTMLIsLocked=”false” –> to true.
This is [...]
My Essential Developer’s Toolbox – Part I
November 23rd, 2008
This is a multi-part post that lists all of the tools that I use on a regular basis as a web developer. The list is Microsoft Windows centric but I will point out the applications that are cross-platform (as best as I can).
IDEs (Integrated Development Environment)*
Microsoft ASP.NET
Both of the IDEs below are top notch and [...]









