Neat way to handle Nullable types …

Posted on January 27, 2009

Ever since I read Rick Strahl's blog post on the C# ?? operator, I've been in love with the C# ?? operator. Mostly I use it as a clean way to test a ViewState variable for null in a property. For example, protected string stringToPersistOnPostBack { get { return (ViewState[this.ClientID + "_stringToPersistOnPostBack"] ?? "").ToString();< } } Somewhere along the way, the real purpose of the ?? operator was ...

Read More

Web Dev Best Practices

Posted on October 10, 2008

This has come up in various conversations recently and I was bored so I was googling for html best practices. I thought this article from Apple was quite good.

Read More

Forcing ASP .Net Validators and ValidationSummary to use CssClass

Posted on September 30, 2008

Here's something strange. If I create a validator using the following mark up: <asp:requiredfieldvalidator id="rfv_txt" runat="server" errormessage="Required" CssClass="errorText" /> and my css class is: errorText { color: purple; } My validator still renders with red text. Checking the markup, I see that ASP .Net has added an inline style attribute (style="color: red"). Obviously, inline styles take precedence over class ...

Read More

WPF Data Binding Not Refreshing When Bound to Static Object

Posted on August 1, 2008

And the WPF Data Binding wierdness/frustration continues ...I have a DataTemplate where DataType is defined. (In other words, WPF magic figures out when to use the template based on the type that is being bound). The Template includes a ComboBox which is bound to a static object in my UserControl class. The SelectedItem of the combobox is bound to a property of the DataTemplate's type (which, in this case, is a linq entity object).It looks ...

Read More

Type casting your User Control Class in ASP .Net 2.0+

Posted on July 31, 2008

I ran into a little bit of a strange issue today:I created a User Control that was being used multiple times on a page. It contained a few public methods and properties that allowed me to delegate loading and saving of the data to the control.Since I have a personal aversion to typing out the same thing for controls with different names, I wanted to just loop through the Controls, check for the type, cast, and call the method. Seems simple ...

Read More