The Code Page
A series of development tips and code examples by Gabriel McAdams
Nov 14

There are several posts on the various forum and question/answer sites where people are wondering if there is an 'In' method in C#.  That, or if there is another quick way to determine if a variable value is one of the values in a given list.

There are a few ways to do this now.  Many of them are tedious.  Adding extra lines of code to do something that should be very simple.



Feb 10

There are a lot of really great controls in the ASP.Net AJAX Control Toolkit.  For those of you who are unfamiliar with the toolkit, it is an open source project that is built on top of the Microsoft ASP.Net AJAX framework (the framework was formerly known by its code-name: Atlas).  It contains over 40 controls that you can use to build highly responsive and interactive Ajax-enabled Web applications.  It is a joint effort between Microsoft and the development community.

Today, I’m going to talk about one of the controls specifically.  The HTMLEditor control.  This control allows you to create and edit html content directly from within your browser.  There are a lot of toolbar buttons available, and you can edit your content using the WYSIWYG (What you see is what you get) pane or the html text pane, and view the results using the Preview pane.


Feb 03

Often, T-SQL developers will ask if there is a way to access some kind of a call stack at runtime.  Either the full call stack or simply the previous calling procedure.  Some uses for this would be to debug a procedure, or to restrict users from updating a table unless it was done through a particular stored procedure.

As of SQL Server 2008, no feature exists.  While searching the web for such a feature, I came across a feature request from 2006 by Erland Sommarskog.  The feature has not yet been added, so we’ll just have to make do with workarounds.  In this tip, I will show you how to make your own callstack using CONTEXT_INFO().


Feb 02

Over the years, I have encountered a few web developers who ignore client side (JavaScript) errors in their applications.  Some have even asked me for ways to suppress client-side errors all together.  With the growing amount of client-side code in web applications, this is a big concern.

It may seem to some that JavaScript errors are inconsequential, but this is not the case.  They are errors just like any other.  Whenever an error occurs, your application is no longer doing what you designed it to do.  A lot of developers feel that there is nothing they can do.  That is on the client.  I have no way of knowing what happens on the client.  In this post, I will provide code that allows the developer to receive notifications whenever a JavaScript error occurs on the client.