Posts Tagged ‘C#’

UI Unit Testing with WatiN – Part #1 – Introduction

There is an arsenal of tools readily available for unit testing web applications. Unit testing both the data access and business logic tiers is a common best practice and a requirement for developing complex web applications. Solutions typically contain hundreds of unit tests exercising every possible use case and edge case covering the data access [...]

Abstracting the RegularExpressionValidator’s ValidationExpression

The RegularExpressionValidator is one of the most useful validators that come standard with ASP .NET. The RegularExpressionValidator allows you to validate, on both client-side and server-side, whether the value of an associated input control matches the pattern specified in the ValidationExpression property. It isn’t uncommon to see a web application littered with almost identical validation [...]

STOP using Response.Redirect(url)

OK, I made the title a little misleading to grab your attention – I’m sneaky like that. Seriously though, there are a few things about Response.Redirect(url) that every ASP .NET developer needs to know. Using Response.Redirect() to help with site navigation is standard and all ASP .NET developers use it but, most don’t have time [...]

ASP .NET – A ValidationSummary with some style

Using the built-in ASP .NET validation controls makes validation a breeze. The controls are an easy and powerful way to validate form data client-side and server-side. If you need to display a summarized list of all the validation errors on a page you can use the ValidationSummary control. Unfortunately, as with most out of the [...]

ASP .NET – Validators in a MultiView

A few weeks ago I needed to create a step-by-step wizard that required more functionality than the built-in Wizard control provided out of the box. I created my custom wizard by taking advantage of the MultiView control which is essentially what the Wizard control is based on. After creating my custom wizard I tackled a [...]

C# – Iterating through an Enum

Today I came across a situation where iterating through an Enum would save me about 10 lines of code and some time. The quickest way is as follows: foreach (MyEnum value in Enum.GetValues(typeof(MyEnum))) { //… }