Hi
I'd like the MVCToolkit to be tolerant of nulls. I've been using ?? "" to avoid the null errors.
<%= Html.TextBox( "Name", ViewData.Name ?? "" ) %>
As an aside, I'm really excited about extension methods, cos you can call them on null objects!!!!!!
public static string MyToString(this object obj)
{
return obj == null ? String.Empty : obj.ToString();
}
// then you can do this;
object a = null;
a.MyToString(); // This looks like you'll get a NullReferenceException
But you don't! No errors, It returns the empty string if a is null. Something like this should be baked into the framework if you ask me.