I've found myself writing more and more client-side script these days, and I recently came upon the need to parse the query string to determine some client-side behavior. Now, where's that handy QueryString collection I'm so used to working with in server-side code? What? There isn't one? Fine, I'll just have to write it myself...

Finding the raw data

The first challenge is knowing where to find the URL information at all in the DOM. The URL is stored in the location object, which is a property of both window and document. The location object has a few properties, ...

Here is a new language feature that saves a lot of time and eliminates some mindless typing...

Tired of writing code like this?

public  class SolutionDescriptor
{
  private  string _folder;
  private  string _solutionName;
  private  string _fileName;
  private  int _lineNo;  
 
  public String Folder
    {
        get {  return _folder; }
        set { _folder =  value; }
    }  
 
  public String SolutionName
    {
        get {  return _solutionName; }
        set { _solutionName =  value; }
    }  
 
  public String FileName
    {
        get {  return _fileName; }
        set { _fileName =  value; }
    }  
 
  public  int LineNo
    {
        get {  ...

I just learnt something new and cool from one of Scott Guthries blogs: the ?? null coalescing operator in C# 2.0. I never noticed it until now, and actually thought it was part of 3.0, until a kind reader corrected me... it's been around ever since the advent of nullable types in C#.

Basically, this operator works like the T-SQL ISNULL or COALESCE function. Read all about it in Scott's blog!

 

I recently installed the RTM version of Visual Studio 2008 (previously known as Orcas), which comes with C# 3.0 and .NET Framework 3.5. One of the coolest new things is LINQ, more on that in my next blog. The next coolest thing is the new C# 3.0 language support for lambda expressions, see the node  => part below:

 

XmlHelper.Visit(_rootTOCItem.ParentNode,  "tocitem",  
  node => _tocItems.Add((XmlElement)node));

I recently wrote a new feature that would detect changes to an item being edited and show a modal dialog listing all other items that would be affected by the change. The problem was that in many cases, the number of affected items could be quite large, causing a significant delay before the dialog would appear. I decided that I wanted to show the dialog immediately, then begin loading the potentially large dataset afterwards while displaying a loading icon.

The Basics

The basics of how to do this are covered on the Telerik website:

  1. On the client, initiate the asynchronous ...

If you want to change a column in a table that is used for replication, you used to have to break replication to make the change, then re-enable it. Not any more. Schema changes are now replicated too. But if you make the change in SQL Server Management Studio, the generated change script drops and recreates the table, which wont work: you will need to alter the columns manually in SQL. Here is an example, where I change the nullability of a column from NOT NULL to NULL:

ALTER  TABLE RA_Actual  ALTER  COLUMN WetDate  smalldatetime  NULL  
This change will be ...