Love hate relationship with Asp:DropDownList.AppendDataBoundItems

Here's the deal.
I want to bind the dropdownlist to a List<Blob>.
But I want the dropdownlist to have an initial empty field.

Most people do this:

<asp:DropDownList ... EnableViewState="true" AppendDataBoundItems="true">
    <asp:ListItem Text="" Value="" />
</asp:DropDownList>

Which is nice and dandy, until you need to update the datasource of the dropdownlist.

AppendDataBoundItems will make sure all the current items stays in the list, and all the ones in the new datasource gets added to the list.

So you ended up writing silly code that looks like this:

string selectedValue = dropdownlist.SelectedValue;
dropdownlist.Items.Clear();
dropdownlist.Items.Add(new ListItem());
dropdownlist.DataSource= List<Blob>;
dropdownlist.DataBind();
dropdownlist.selectedValue = selectedValue;

 

I promise my next code rant will look a lot better than this rubbish!

New words

Went to a mandatory AGILE methodology meeting session currently being pushed by the client.  Personally I consider myself already sold on Agile methodologies, so feels somewhat that it was going to be a gigantic waste of time.  But it was mandatory, so to keep everyone happy, I went.

I went with a notebook, and just moments before the session, I had a brilliant idea of noting down any new words I'm about to learn that day:

spike-solution

We call it a deep-slice, but it's slightly different.  A spike solution is a focused technical effort to explore whether a technical design is actually possible or feasible.  In the particular Agile session it seems the spike solution is also a throw-away solution.  But I can see it being documented on a dev-wiki until it's used in implementation.

A spike-solution is good because it reduces risk - if an approach can not work, it is better to know early rather than later (say, after all the UI, database, etc have been designed).

re-engineering

It's like re-factoring, but not re-factoring.  It's re-engineering.  You can't engineer a business process, because it's business and not engineering.  But you can re-engineer a business process (I guess by applying engineering processes to a business procedure).

I consider this word a "rubbish word thrown-in to confuse people".

Silverlight 1.1: Feels very raw

I've been playing with Silverlight for perhaps 2 weeks now.  Evaluating it for a business application, here are some findings:

Silverlight 1.0

It's just fantastic that Microsoft actually got this out of the door.  Programming with Javascript is simple.  More a Flash app than a business app, but stable and rock solid. 

Silverlight 1.1 (now renamed to 2.0) Alpha

Programming with managed code is awesome.  Lack of standard controls really sticks out at you, everybody is writing their own versions of TextBox, DropDownList, etc etc.  No Cross-Domain web service calls is annoying too.  Writing XAML in Blend is a lot easier than in VS.NET even with the Silverlight tools installed.

Silverlight 2.0 Beta

Apparently this will be released in a few more weeks' time, before MIX 2008.  It's got everything.  More controls, better network stack.  All for under 5mb download.  Go-live licence.

I'm somewhat annoyed they won't allow sockets - I want to write a game :-(.

jliu

A (near) perfect project for 2008

A (near) perfect project for 2008 would be:

  • Use WPF for front-end (or WPF/E silverlight)
  • Use LINQ for business tier (C# 3.5)
  • Use SQL Server 2008 for the database

Bonus points

  • Use XNA libraries (hmm starting to sound like a game!)
  • Pay lots of money (no, can't be a game then)

If you have a project like above, and are after an experienced .NET developer email me NOW!

jliu

Why should I specialize? Why should you specialize?

Was asked over a company coffee thing.
"Oh you are interested in WPF"
"Yea"
"What are you planning to do with it?"
"Eh?"
"What is your next step?"

I was caught unprepared.  I've always seen myself as expert in anything I want to do.  Why not?  Why limit yourself to one technology tree?  What happens when that technology is a dead-end?
I've done Java, and now I'm sold on .NET.
I've done both Windows Forms and Web Forms.
I've done SQL Server 2000, 2008...
Part of the reason I've never been convinced of SharePoint.  Initially it was this portal system.  Then it seemed to compete with ASP.NET 2.0.  After a while... it got bundled into everything: Microsoft Office SharePoint.
Perhaps there is someone really high up in Microsoft that refuses to let it die.

There always seem to be these people (Evangelists) that seemed to know everything there is to know, about everything.
How do you go about becoming one of those?

Anyway, I can see the company's point of view.  Master of One Trade is easier to sell (and train) than Jack of All Trades.

But I still feel if I had to abandon any one of my many interests, it'd be like cutting my arm off :-(

jliu