Creating a custom list form with Sharepoint 2007

Today I ran in to an oddity with Sharepoint 2007.  Since the upgrade, users said the flow of creating a new entry for one of our lists wasn't very easy as everything was in a different order.  I went into the List Settings and updated the "column ordering" to match what they wanted.  However, this didn't update the order of fields when the users clicked on "new entry".  Isn't this how it worked in Sharepoint 2003?  I couldn't find an easy way to control the field order on NewForm.aspx so I started searching for how to customize it.  This took me to Jan Tielson's blog post which was a reference to Kristian Kalsing's great blog post.  This was exactly what I needed but I did hit a few parts that stumped me for a bit so I thought I'd post essentially the same steps with just a few warnings and extra details.

  1. Open your site in SharePoint Designer.
  2. Browse to your list and open the 'NewForm.aspx' web form.
  3. Go File > Save As... and give the form a new name such as 'NewForm2.aspx'.
  4. Delete the default List Form Web Part from the page.   So delete everything starting at and including <WebPartPages:ListFormWebPart......> down through and including </WebPartPages:ListFormWebPart>.  This should leave you with... 

    <WebPartPages:WebPartZone runat="server" FrameType="None" ID="Main" Title="loc:Main">


  5. Save...(otherwise you'll be missing the "Custom List Form" option in the next step. )
  6. Put your cursor between <ZoneTemplate> and </ZoneTemplate> and then click Insert > SharePoint Controls > Custom List Form. (Note: Make sure you pick "Custom List Form" and not "List Form" or you won't be able to customize your form and then what's the point? <grin> )
  7. In the List or Document Library Form dialog, select the appropriate list, content type and type of form.
  8. Click OK. Now you'll have a new Data Form Web Part added with controls representing all the fields from the list
  9. Now you can make the customizations you want and Save your NewForm2.aspx.

That's it.  I found it's easier to me to change the view to "Code" and make my changes via HTML rather than the designer.  It's always stopping to update real-time and that left me waiting a lot.  You'll see that now it's really easy to cut and paste to reorder table rows.  After testing out your new form, if you want to make this the new default then...

  1. Right click on the root of your List  and select Properties.
  2. Click the Supporting Files tab and click Browse for the "New Item Form" value.
  3. Select "NewForm2.aspx", click OK
  4. Change the "Content type specific forms:" from Folder to "Item".  If you don't make this change, then "Supporting Files" changes won't actually save! 
  5. Click OK.

List Properties

That should do it.  Now when someone clicks on 'New Entry' it'll use your new custom form. This of course is the same process to update the Edit and Display forms as well. Thanks to Jan and Kristian for their blogs to get me going.  Hopefully this will help someone else if you're stuck.  Since all I wanted to do was change the order of the fields on a "New Entry", I'm not sure why all this was necessary and there's probably some easy way in the "settings" somewhere but until I find it...I hope this helps.

Visual Studio 2005 64-bit error (incorrect format - HRESULT: 0x8007000B))

I was working through some SQL Compact Edition tutorials and kept getting errors trying to run the most basic of applications.  "An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)".  This was running on my 64-bit Vista laptop.  My regular 32-bit desktop with Windows XP worked fine.  So was it Vista or 64-bit.  This time, it was 64-bit.  The solution was to go into the project properties and set the "Platform Target" to "x86" instead of "Any CPU".  Setting it to x64 gave the same error as well so I'm not sure what the fix is to get it to run true 64-bit apps without the error. The problem may be SQL 2005 CE but I don't think so.  But for now, changing the "Platform Target" got me past my problem.

Installing SQL Server 2005 replication for SQL CE

If you're trying to install the SQL 2005 Compact Edition Server Tools, on of the pre-requisites is the SQL 2005 Replication Tools.  That seems simple enough but finding where to install that gave me fits.  Finally I found a Microsoft link that showed me where it was located.

  • In the SQL Server Installation Wizard, on the Components to Install page, click Advanced.

  • On the Feature Selection page, click Client Components, and then click Connectivity Components to install the SQL Server 2005 replication components

Google Analytics with SubText

I could not figure the best way to add Google Analytics to my SubText site.  I thought of adding it to a skin which would be easy enough but I needed it on a "per blog" basis, not "per skin".  Then I found Mladen Projdic's blog post that solved the problem.  It's really quite simple.

In the "Admin" for your blog, click on "options" and there you'll find the section for Static News/Announcements.  Just drop your Google Analytics script code right there and that's it.  Nice and simple and "per blog".  No code change required!

Multiple blogs on SubText

Are you new to the SubText blogging package and not sure how to set up multiple blogs on a single install?  I love SubText but I was stumped by how to set up multiple blogs.  At, the Docs gives a detailed explaination of what's happening in the app and database code but was I suppose to start manually updating the database?  Turns out "no".  Just add /hostadmin to the initial URL you set up and log in with your original username/password (i.e.  http://<yourSubTextURL>/hostadmin ).  This gives you an easy interface to create multiple blogs.  Piece of cake if you know what to do.

On an embarrasing side note, this is clearly documented at if you go to the "Configure" section of the "Documentation". But you do have to actually go and read! 

Visual Studio 2005 "release build" option missing

While working on my SubText web site, I realize I accidentally deployed my code in debug mode.  So I opened up VS 2005 to build as a "release" and redeploy.  Surprise, I had no "release" option only a "debug" option in Configuration Manager.  After searching and searching, I finally found this post on K. Scott Allen's blog about the differences between 'release' and 'debug' builds.  The problem (or maybe "cause" is the right word) stems from the fact that I had set the debug mode in the web.config.  According to Scott..

This new compilation model makes the Configuration Manager for a web site obsolete. The only option appearing in a Visual Studio 2005 web site “project” is a Debug configuration. Don’t fret – it means nothing. The web.config file now rules the school.

Now, I know I've had "debug=true" in many of my web.configs and I don't remember the "Configuration Manager" taking the release option away but that certainly seems to be the case now.  I hope this saves you some time trying to track this down.