Scott Hanselman

How to show multiple columns in an ASP.NET Mobile ObjectList

July 20, 2006 Comment on this post [1] Posted in ASP.NET
Sponsored By

An object list with one columnWhen using ASP.NET Mobile Controls to display a list of information, you'll usually use an ObjectList and databinding. ObjectList is a great control with lousy documentation.

When you turn off AutoGenerateFields and bind a collection of objects to the list - as I'm in banking, my example is always "Accounts" - you need to give a list of Fields that you want to bind to.

<mobile:ObjectList
        ID="listAccounts"
        Runat="server" 
        AutoGenerateFields="False" 
        TableFields="Description;AvailableBalance">
    <Command Name="AccountHistory" Text="Account History" />
    <Command Name="Transfer" Text="Make a Transfer" />
        <Field DataField="Description" Name="Description" Title="Account" />
        <Field DataField="NumberMasked" Name="NumberMasked" Title="Number" />
        <Field DataField="AvailableBalance" DataFormatString="${0:0,0.00}" Name="AvailableBalance"
            Title="Balance" />
        <Field DataField="Index" Name="Index" Visible="False" />

</mobile:ObjectList>

An object list with two columnsHere's the icky part. By default the list will only show the FIRST field - in my case "Description" - in the list. It'll be hyperlinked to a subform that will show the rest of the fields. Remember, we're designing for mobile here.

The useful little-known/documented trick is that if you put a semicolon separated list of DateFields in the TableFields attribute you'll get multiple columns when the ObjectList first displays.

One other unrelated note. For some reason when I use DataFormatString="C" to format the decimal AvailableBalance as a Currency, I get a string star-like character. Perhaps something wrong with the current UI culture. I worked/hacked around it with a format string like DataFormatString="${0:0,0.00}" for now.

 

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Time Saver - Using Watir as a Startup Program in your ASP.NET Projects

July 20, 2006 Comment on this post [10] Posted in ASP.NET | Ruby | Watir | Bugs
Sponsored By

Often when you're inching forward within an ASP.NET project you'll find yourself repeating actions over and over again to get to a certain page, often three or four actions in to the application. As someone who hates repetitive actions this is what I do.

(These examples are in VS2005, but will work in VS2003, although the property dialogs have changed)

I use Watir to automate the clicks that will get me to where I'm going and set my Watir script to startup when I press F5 to start my project debugging.

Aspnetrubystart1

In this example, I have a script called justsignon.rb that signs on, visits the customer's accounts page, then goes to their Account History page. It's that page that I am currently debugging so I want to automatically show up there in a certain state when I start debugging.

require 'watir'

include Watir

require 'test/unit'

class WatirMakerRecorded < Test::Unit::TestCase

    def test_recorded

        ie = IE.new

        ie.goto('http://localhost:4970/MobileDemo/default.aspx')

 

        ie.text_field(:name, 'userTextBox').set('testuser1')

        ie.text_field(:name, 'passwordTextBox').set('123456')

        ie.button(:name, 'signInCommand').click

        ie.link(:text, /Hanselman/).click

        ie.link(:text, "Account History").click

        #UPDATE - the debugger will detach if the spawned process ends, so wait for ENTER

        gets

    end

end

Aspnetrubystart2

As I move forward in my development process I use different scripts to get me to different states.  This easily adds up to as much as 15 minutes to a half hour of rote "monkey clicking" that is usually wasted time.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

A half-year Podcasts

July 20, 2006 Comment on this post [11] Posted in PowerShell | ASP.NET | TechEd | Speaking | XML | Gaming | Bugs | Tools
Sponsored By

Hanselminuteslogo2When podcasting first came out I declared it totally lame in October of 2004.  Actually I said:

Sorry folks, PodCasting = Verbal Incontinence.  I'm just not feeling it.  You can't speak as fast as I read.  I don't like it when you read your PowerPoints to me, and I REALLY don't like it when you ramble on.  My commute isn't nearly long enough to slog through your PodCasts to find a nugget of goodness.  If you blog, I can ignore it, or read it in any order. I can skip forward by, gasp, moving my eyes. [Me in 2004]

Other folks had some good comments on Podcasting back in 2004:

FastmediaplayerThen fifteen months later I started a Podcast. I had started using iTunes' Podcast Directory and re-listened to some episodes of DotNetRocks. Carl Franklin called me and convinced me that if there was a short Podcast that was densely packed with information, it might not suck. After I started the podcast, Martin Plante said podcasting still sucks, but later came around and said it sucked less. :) Others have also had nice things to say. I also found that listening to a Podcast in double speed was helpful.

A half year later, we've hit 25 podcasts and had a blast doing it. I encourage you to check them out if you missed a topic you might be interested in. Also note that they all have PDF Transcripts if you prefer to read your podcasts.

A Half Year of Podcasts

Anyway, thanks again to Carl for the hard work and idea. Thanks to Travis for the name. Thanks to the listeners for listening. As always, send me your topics!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Z at Seven Months - A look back

July 18, 2006 Comment on this post [11] Posted in Bugs | Parenting | Tools | Z
Sponsored By

Wow. From...

 to CIMG5590 

...in seven and a half months. Madness I say.

This little man is heck on wheels. The first day I met him...

...he was eyes wide open. He spent a few months on and off tummy time...

...and rolled over shortly thereafter. Crawling came four months later...

...but the shock to me was that he was sitting up one Tuesday, crawling that Thursday and now has taken to standing on things. We found him trying to climb out of his crib. Mo caught him trying to eat the toilet plunger (Full story on Mo's Blog). He really wants to walk, but just doesn't know how. So, standing will do for now.

 CIMG5552CIMG5581CIMG5486

CIMG5546CIMG5494

He's a joy each day and I'm blessed beyond comprehension to know this guy.

Lessons learned at Seven Months

  • Anything two feet off the floor or below will be put in the mouth. This includes peas from last week found in a corner as well as bugs and dust. At least the latter two are protein.
  • Baby's are as surprised as I am when they poop without warning. Has there been an earthquake? 
  • Other people's babys are cute, but they are scary, fragile, and often smell bad. YOUR baby, on the other hand, smells like roses all the time and can be thrown around like a sack of potatoes to peals of laughter and giggles.
  • When your baby isn't quite a crawler but definitely not a toddler, he's a wobbler.
  • Nothings better in this world than the look of recognition your baby gets on his face when you come home from work and he gets that look that says "Hey! It's that guy again, he's back! Woohoo! He's hilarious!"
  • Water and the laws of physics in general may not be consistent, so we'll need to test them over and over and over again. Will the spoon fall this time? Wow, it did. I wonder now?
  • There's only 365 days in this first year. Squeeze every one of them.

Baby Posts

And now back to the technology...

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Roy Osherove's Windows Desktop Beauty Contest 2006

July 18, 2006 Comment on this post [4] Posted in ASP.NET
Sponsored By

Roy Osherove is having a beauty contest...a Windows Desktop Contest.

You send in a screenshot of your windows Desktop - the coolest three at the end of the contest get some cool prizes.

  • 1st prize: MSDN Premium Subscription and fame forever.
  • 2nd Prize: To be announced
  • 3rd Prize: To be announced

The contest ends August 31st 2006. The Judges are Roy, myself, Carl Franklin and Mike Gunderloy. Just the chance to win an MSDN Premium subscription is reason enough to submit your shot now! Get over there and crush his servers with the weight of your awesome desktop.

Scott2006homedesktop

Here's my home desktop. It's not nearly as cluttered at home as at work. Here's my work desktop:

Hanselmandesktopscreenshot20060703

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.