August 27, 2008

A Dynamic Menu For Your Dynamic Data

So I am still playing around with building a Northwind Dynamic Data web site.  Tonight I thought it would be interesting to see what it would take to create a menu for navigating the tables in the site.  I was particularly interested in seeing if I could get some grouping or categorization to the metadata so I could create a multi-leveled menu.  It turns out it wasn't too difficult at all (see the screen shot below - the menu is on the left).  I have my tables organized into 4 categories: Sales, People, Products and Reports.  And the cool thing is that this menu is completely dynamic.  You can add, remove or reorganize the categories without touching the UI.  And depending where you are keeping your metadata you could even do this without recompiling your app.  The grouping is automatically discovered from the metadata and the menu is built solely...

Topics: ASP.NET , Dynamic Data

August 24, 2008

Dynamic Data and Custom Metadata Providers

In my previous post on Dynamic Data, I mentioned that you can use the MetadataType attribute to point Dynamic Data at class that contains additional metadata for your model.  This additional metadata will give you more control over how your UI elements render.  If you don't want a column to display in your GridView, want to change the column header text from EmployeeID to Employee ID or want the cell values formatted a little differently this metadata class is where this information gets specified.  The code snippet below shows how this class can be used for customization. [Update: 9/21/2008]: Added link to live demo Download | Live Demo 1: // Attach the Employee Metadata to the Employee 2: // entity that the LINQ to SQL designer generates 3: [MetadataType(typeof(EmployeeMetadata))] 4: public partial class Employee 5: { 6: } 7:  8: // Attach some additional metadata 9: public class EmployeeMetadata 10:...

Topics: ASP.NET , Dynamic Data

August 21, 2008

ASP.NET Dynamic Data - Simple 5 Table Northwind Example

I have been anxiously awaiting the Dynamic Data release.  And now that it is here (it was released with VS 2008 and .Net 3.5 SP1) I decided I would start getting a feel for what is has to offer by building a real simple Dynamic Data web site that allows you to browse the 5 core Northwind tables - Customers, Employees, Orders, Products and Suppliers.  Read on for the details and don't forget to download the code.  DiscountASP hasn't quite upgraded to SP1 so I don't have a live demo setup.  Hopefully they will get the upgrade completed soon, but I made sure to include lots of screen shots so you can get a good idea of what the screens look like.  [Update 9/21/2008] : Add link to the live demo Download | Live Demo   What is Dynamic Data? I try to keep a close eye on ASP.NET, but...

Topics: ASP.NET , Dynamic Data

August 18, 2008

IE, Operation aborted and MSDN

Since writing this post on DOM manipulation about a week ago msdn has crashed on me three times with the dreaded operation aborted exception.  Following Dave Reed's comment here, it looks like this is probably occurring because the call to ASP.NET AJAX's client side initialization function is too far away from the forms closing tag - causing the Sys.Application.init event to fire before the DOM is really ready (view source on one of the pages and you will see what I am talking about). Here is an excerpt from Dave's comment: ScriptManager does not put the call to initialize in a “random” location. It is in fact, always the very last thing in the form, just before the closing form tag. There shouldn’t be anything after that (for better or for worse, form is a major part of an asp.net page), and if there is, it could only be because...

Topics: Other

August 14, 2008

Custom Sort Icons with Silverlight 2's DataGrid Control

While looking through the control templates for Silverlight 2's DataGrid, I noticed the DataGridColumnHeader defines a couple of StoryBoards that allow you to control how the headers are displayed as they pass through the three column states: {Sorted Ascending, Sorted Descending, Unsorted}.  And without too much work you can override the default display and customize it to your liking.  I took a crack at overriding these states to mimic the icons the awesome jquery tablesorter plugin uses - below is a sample table that shows how it turned out.  Read on for the details (there really aren't too many) and don't forget to check out the live demo and download. Live Demo | Download   Default Sort Indicator If you look at the default template for the DataGridColumnHeader you will see the control uses a Path shape (named SortIconElement) to describe the sorting icon (the value of the Data attribute...

Topics: Silverlight 2

August 10, 2008

Angled Column Headers with Silverlight 2's DataGrid

At the software shop I work at screen real-estate is always at a premium.  The bread and butter of our business is data, and the more of it we can fit on a screen the happier our customers are.  Sometimes, to cram more data into our grids, we end up abbreviating column headers, wrapping them or possibly combining 2 or 3 data elements into a single cell.  Usually this works out O.K., but sometimes we still run out of room.  When this happens we either remove columns, or break the grid across separate pages.  Honestly, usually none of this is a huge problem.  But there is that certain class of data that just doesn't fit well into an HTML TABLE - when the length of the data elements are substantially smaller than the data label's.  The grid ends up looking too sparse.  I hadn't thought of this before, but football...

Topics: Silverlight 2

August 05, 2008

When is it Safe to Modify the DOM?

This is a pretty important question when in comes to DOM programming.  Start manipulating the DOM to early and bad things happen.  Do it too late and the users may see that annoying flicker.   So what's the best technique for figuring this out?  Well, I was curious about this myself so I took a look at how some of the popular Ajax libraries (jQuery, MooTools, YUI, Prototype and ASP.NET AJAX) are doing this.  Here is what I found out ...   Update: 08/11/2008: I came across an article that sheds more light on ASP.NET AJAX's init technique.  There is a lot of good content in the comments as well (look for the ones left by Dave Reed).  Here are a few snippets of what Dave has to say ... His comments with respect to the location of where the ScriptManager injects the call to Application.initialize ... ScriptManager does not put...

Topics: ASP.NET AJAX , Other , jQuery


Consulting Services

Yep - I also offer consulting services. And heck, I'll do just about anything. If you enjoy my blog just drop me an email describing the work you need done.

Recent Comments

  • TimothyP wrote: I work with tons of developers who haven't even got a clue what Twitter of Facebook is. In fact, it'...
  • Janko wrote: Yes it's strange that people think it's ok to blog at work but consider unethical to use facebook. P...
  • Kam Lagan wrote: Hi Matt, The numbers do seem a little "off" to what you perceived the community would be like. But...
  • Siderite wrote: You're kidding me! So the people that don't blog think it is ok to blog at work (maybe because they ...
  • Guy Harwood wrote: Good to see the results. one typo.... 'What best describes your current job title?' appears twice,...
  • sirrocco wrote: One problem with : DEV I DEV II DEV III was that I didn't know what it meant :( .(is it common ...
  • Jack wrote: How many person fill the survery? Blog is very common, so I don't think 71.5% is high. Maybe our bos...
  • Andy wrote: Done. The developer1, developer2 question - not sure how meaningful the results are going to be for ...