# Tuesday, 06 June 2006

Most people are getting aware of the new upcoming version of Office. There are already several resources available and I thought I'd list some:

Some videos: Channel 9 In the office
Some report by Forrester: Developers get ready for 2007 Office system
A quick introduction to the new UI of 2007 Office System: First look 2007 Office System
extension code samples, supplemental developer white papers: 2007 Office System Starter Kit: Enterprise Content Management Starter Kit

Grz, Kris.

Tuesday, 06 June 2006 20:02:40 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 

Anyone who knows me, knows that I like Star Wars. I was quite amused when I found out about this little flash movie: Store Wars.

Grz, Kris.

Tuesday, 06 June 2006 19:12:23 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, 05 June 2006

I read this kind of questions multiple times on the $blank(forums.asp.net,ASP.NET forums). Most of the time it's suggested that one can use one of the events of the grid control they're using to use the FindControl method to find a Label control in one of the template columns and add the current row number to its Text property. I also used to do it like that when I started with ASP.NET.

However it can be done easier, and in markup, without the use of events, and best of all, the grid controls(1) of ASP.NET support the technique.

Figure 1: The GridView, DataGrid, Repeater and DataList controls shown to present the technique.

If Figure 1 you can see that it also supports pagination, which is shown in the GridView control.

Code says more than words so here goes:

    1 <%@ Page Language="C#" %>


    3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


    5 <script runat="server">


    7     protected void DataGrid1_PageIndexChanged(object source, DataGridPageChangedEventArgs e)

    8     {

    9         DataGrid1.CurrentPageIndex = e.NewPageIndex;

   10         DataGrid1.DataBind();

   11     }

   12 </script>


   14 <html xmlns="http://www.w3.org/1999/xhtml" >

   15 <head runat="server">

   16     <title>Autonumbering grid controls</title>

   17 </head>

   18 <body>

   19     <form id="form1" runat="server">

   20     <div>

   21         GridView</div>

   22         <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"

   23             AutoGenerateColumns="False" DataSourceID="SqlDataSource1" PageSize="5">

   24             <Columns>

   25             <asp:TemplateField>

   26                 <ItemTemplate>

   27                     <%# Container.DataItemIndex + 1 %>

   28                 </ItemTemplate>

   29             </asp:TemplateField>

   30                 <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />

   31                 <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />

   32             </Columns>

   33         </asp:GridView>

   34         <br />

   35         DataGrid

   36         <br />

   37         <asp:DataGrid runat="server" ID="DataGrid1" DataSourceID="SqlDataSource1" AllowPaging="True" OnPageIndexChanged="DataGrid1_PageIndexChanged" PageSize="5">

   38             <Columns>

   39                 <asp:TemplateColumn>

   40                     <ItemTemplate>

   41                         <%# Container.DataSetIndex + 1 %>

   42                     </ItemTemplate>

   43                 </asp:TemplateColumn>

   44             </Columns>

   45         </asp:DataGrid><br />

   46         Repeater<br />

   47         <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">

   48             <ItemTemplate>

   49                 <span style="margin-right:20px;"><%# Container.ItemIndex + 1 %></span>

   50                 <span><%# Eval("CategoryName") %> <%# Eval("Description") %></span><br />

   51             </ItemTemplate>

   52         </asp:Repeater><br />

   53         DataList

   54         <br />

   55         <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">

   56             <ItemTemplate>

   57                 <%# Container.ItemIndex + 1 %>

   58                 CategoryName:

   59                 <asp:Label ID="CategoryNameLabel" runat="server" Text='<%# Eval("CategoryName") %>'>

   60                 </asp:Label><br />

   61                 Description:

   62                 <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>'>

   63                 </asp:Label><br />

   64                 <br />

   65             </ItemTemplate>

   66         </asp:DataList>

   67         <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"

   68             SelectCommand="SELECT [CategoryName], [Description] FROM [Categories]"></asp:SqlDataSource>

   69     </form>

   70 </body>

   71 </html>

For simplicity I used the SqlDataSource control that ships with ASP.NET 2.0 and used the Northwind database (lines 67 - 68). The following lines are of importance: 27, 41, 49 and 57. The + 1 is added each time because of the zero based index.

As you can see, it's each time a very simple addition to the markup of the grid control you're using but it adds that nice extra touch of information that endusers like to see.

Grz, Kris.

(1): I tested it upon the GridView, DataGrid, DataList and Repeater controls.

kick it on DotNetKicks.com

Monday, 05 June 2006 15:27:28 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
# Sunday, 04 June 2006

While reading through the blogs I'm subscribed to, for the ones interested I use RSSBandit, I found these interesting links(1) on the blog of Smetty's Soapbox.

On figure 1 you can clearly see that the forename Kris was quite popular in that time. On figure 2 you'll see that my last name van der Mast is most popular where I live. For the ones who know a bit about the geography of Belgium: I live in Essen which is at the top of the red colored part on the map.

Figure 1: Kris was quite a popular name when I was born in 1975.

Figure 2: van der Mast is most popular in the province of Antwerp.

Grz, Kris.

(1): Forename & Lastname.

Sunday, 04 June 2006 09:57:02 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, 03 June 2006

Like most ASP.NET developers I also first installed SQL Express 2005 together with visual studio.net 2005. After a while however I decided to get it off my dev laptop and install the full blown SQL Server 2005 instead because I wanted to test against this database and because I also needed it for an internal course at work. Things went fine, I also played around with the aspnet_regsql tool to make a dedicated database for my ASP.NET 2.0 services like Membership. I even changed the default setting for the LocalSqlServer connection string in my machine.config file in order to not be forced to override that setting in each new webproject I created.

After a while I felt the urge to reïnstall SQL Express 2005 because I downloaded several example sites and starter kits. Although it's quite easy to attach a .mdf file to SQL Server 2005, you can read my blogpost about it here: Attaching a .mdf file when you don't have the .ldf file available.

The installation went smoothly, I could see the extra database in SQL Server Management Studio but when I wanted to add a new local database, ie SQL Express database, in the App_Data subfolder of a web project I got this error:

"Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed."


Well I search around, gained some knowledge about the problem and thought I share it with you:

First you'll need to open up SQL Server Configuration Manager. Navigate to that in the menu like Microsoft SQL Server 2005 > Configuration tools > SQL Server Configuration Manager. Take a look at figure 1:

Figure 1: The SQL Server Configuration Manager tool.

Double click, or right click and choose Properties, of the selected line and you'll get the properties window which you can see in Figure 2:

Figure 2: The properties window

You'll need to make sure that the Local system is selected.

The second part of the solution's to delete the following folder on your hard drive: c:\Documents and Settings\[user]\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS(1). This folder's used to store information and apparently it messes up the proper working of SQL Express.

Grz, Kris.

(1): http://forums.microsoft.com/msdn/showpost.aspx?postid=98346&siteid=1

Saturday, 03 June 2006 19:23:25 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 

Microsoft launched the download site for SQL Express with advanced services.


Microsoft SQL Server 2005 Express Edition with Advanced Services (SQL Server Express) is a new, free, easy-to-use version of SQL Server Express that includes a new graphical management tool and powerful features for reporting and advanced text-based searches. SQL Server Express provides powerful and reliable data management tools and rich features, data protection, and fast performance. It is ideal for embedded application clients, light Web applications, and local data stores.

SQL Server Express with Advanced Services has all of the features in SQL Server 2005 Express Edition, plus you can:

  • Easily manage and administer SQL Server Express with a new easy-to-use graphical management tool -- SQL Server 2005 Management Studio Express (SSMSE).
  • Issue full-text queries against plain character-based data in SQL Server tables. Full-text queries can include words and phrases, or multiple forms of a word or phrase.
  • Run SQL Server Reporting Services reports on local relational data.

Free to download, free to deploy, and free to redistribute as an embedded part of an application, SQL Server Express with Advanced Services is the fast and easy way to develop and manage data-driven applications with powerful built-in reporting and full-text search functionality.

Grz, Kris.

Saturday, 03 June 2006 15:47:28 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Friday, 02 June 2006

A lot of sites allow people to upload a file like pictures, word documents, ... or even videos. ASP.NET provides an easy way to do this(1).

What not everyone seems to know that ASP.NET only allows, by default to upload 4Mb of formdata to the server. Endusers can get frustrated when they try to upload their large sized document or video and see, after wasting bandwidth and time, that they don't succeed. This leaves your endusers with a bad taste in their mouth about your application and most likely they won't return or go to the competition.

However, as with many things in ASP.NET, this can be easily adjusted. Open up the web.config file of your current application and check the line, or add it in case it isn't already in the config file, <httpRuntime /> (2). This has an attribute maxRequestLength that you can set. The number represents the amount of kilobytes that the total form can transfer to the server. Setting this to a higher number than the default 4098 allows you, the developer, to let endusers upload larger sized files.


Grz, Kris.

(1): Uploading Files in ASP.NET 2.0, Uploading Files Using the File Field Control or Uploading in ASP.NET to name a few.
(2): Take a look at the documentation for other settings that you can make.

Friday, 02 June 2006 15:31:52 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, 31 May 2006

Just found out about this one: http://www.seewindowsvista.com/. It has some smooth looking videos available organised into 4 categories:

  • Connecting with people
  • Managing the big picture
  • Turning information into action
  • Expanding your possibilities

Another site that was release recently is http://www.iis.net/, a site totally dedicated to IIS6 and the new upcoming IIS7. Also be sure to check out the virtual labs.

Some other sites about upcoming technologies that'll ship with Vista, and will also be available for Windows XP with Service Pack 2 and Windows server 2003:

  • WPF (Windows Presentation Foundation, formerly known as Avalon)
  • WCF (Windows Communication Foundation, formerly known as Indigo)
  • WF (Windows Workflow Foundation)

Of course, people who know me, know that http://forums.asp.net/ is still one of my most visited sites. Not only to help out people there but also to still learn from others too.

Grz, Kris.

Wednesday, 31 May 2006 20:51:53 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 

I've read some good feedback on this tool before and also installed it at work where I use SQL Server 2005 Management studio on a daily basis.
Once you get used to Intellisense in visual studio.net you always get that creepy feeling: where's Intellisense when you want to query your database? Well, SQL Prompt fills that gap and saves you valuable time while developing or creating another inner join. The tool can be downloaded here for free until September 1st 2006.

Wednesday, 31 May 2006 20:04:51 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Monday, 29 May 2006


ASP.NET 2.0 is promoted quite heavily by Microsoft and other companies or dedicated sites. What most people seem to love are the starter kits which have several dedicated members that like to extend these starter kits and expose these on the internet. If you would be interested in extending some of the starter kits, or just have one deployed as your own personal website, you can download them here.

Most of these starter kits ship with a sample database which normally consists of a .mdf and a .ldf file. Not all people have SQL Server 2005 Express edition installed but rather only SQL Server 2005. It's quite easy to attach such an Express database to SQL Server 2005 when you have both files available but as I found out in the past sometimes only the .mdf file is provided which prohibits one to attach the database the normal way.

Luckely there's a special procedure available: sp_attach_single_file_db.

An example on how to use it:
EXEC sp_attach_single_file_db @dbname = 'pubs', @physname = 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf'

The @dbname = and the @physname can be omitted if you like.

Grz, Kris.

Monday, 29 May 2006 20:25:24 (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  |