Tuesday, December 27, 2005 6:10:49 PM UTC :: Filed Under ASP.NET

One of my favorite words in the English language is “free” :-)  If you’re interested in learning more about the Agile Development, you be happy to learn that the book “Essential Skills for Agile Development” is available online… for free!

Essential Skills for Agile Development

Tuesday, December 27, 2005 6:07:29 PM UTC :: Filed Under ASP.NET

In today’s programming world, it seems like any article you read that is six months old or older is no longer relevant.  However, I recently found a very interesting article written in 2003 that addresses the topic of off-shoring developer jobs… and it discusses some things that we, as developers in the good ol’ US of A, can do about it:

Achieving Reuse in ASP.NET – Part1: Barriers to Reuse by Scott Bellware

It wasn’t until recently that I jumped on the Test Driven Development (TDD) bandwagon, as the article discusses, and I wish I would’ve done it sooner.  Making my code a bit more reusable still seems like something I could use a lot of work on as well.  I spend way too much time re-inventing the programmer wheel!

Thursday, December 22, 2005 5:18:10 PM UTC :: Filed Under ASP.NET | Web Design

One of the biggest pains is testing a web application is testing the User Interface (UI).  When you’re trying to track-down a bug that occurs after clicking through 20 different links on your site and having to fill-out multiple forms, you’ll soon start pulling your hair-out but might have thought there was no other way around doing this manual testing.

For those of you who can’t afford Visual Studio Team System 2005 (which has a UI recording tool), there is still hope!  Alex Furman created an incredible application called the SW Explorer Automation Designer that can automate UI tests for you and its free!

Click here to enlarge

I just downloaded it and ran through the same scenario that is shown in the online demonstration.  I must say that I’m impressed and I wish I would’ve discovered this tool a long time ago.  Granted, it only works with Internet Explorer, but that’s ok for me as most of the applications I build target IE as the primary browser.  I highly recommended going through the demo step-by-step (keep your cursor over the ‘pause’ button!) to learn how to use the tool.

Setting-up a test takes a little bit of time, but I think it’s worth taking a few minutes up-front to save you many minutes (or perhaps hours or days!) when testing your site. If you'd like to integrate your SWE tests with your NUnit tests, TestingReflections.com has an article explaining how to do that (in C#, of course :'( )

Wednesday, December 21, 2005 9:33:16 PM UTC :: Filed Under ASP.NET | Web Design

Seems that a new HTML tag pop-ups every once in a while that I wasn’t aware of.  Today it’s the <label> tag.

So what is the label tag for? Using the label allows the user to click on the text associated with a form control instead of having to click on the radio button, check box, select box, etc.

Granted, this isn’t likely to be hugely useful to you, but I know I’ve often found it convenient to simply click on text next to a check box (or similar form field) when I’m in a hurry, hence it increases the usability of your page.

However, if an accessible web site for the visually impaired, using the label tag helps those who visit your site with a screen reader to associate a fields label with the field that it belongs to.

How do you use it?  Here is how:

<label for="radio1">This Radio Button 1 has a label associated with it.</label>

<input type="radio" value="Selected" name="Radio" id="radio1">

One thing I find convenient about the label is that I can now create a CSS style for the HTML label tag and know that all the field labels will be formatted the same. I no longer have to create a <span> or <div> tag with a special CSS class for field labels.

However, in ASP.NET, I could envision the label not working as it’s supposed to in many cases because it’s often hard to predict the name of the field controls.  For example, if I have a textbox with an ID of “txtFirstName” which is nested in a User Control, which is nested in a Page, which is nested in a Master Page, ASP.NET will rename the control and it’s ID to something like “ctl001 MyMasterPage MyPage MyUserControl txtFirstName.”

With that in-mind, the functionality of the label control might be limited in ASP.NET applications, but at least it provides a new tag to bind CSS to! :-)

Update - 01/06/2006

Those guys at Microsoft are no dummies... they made sure the ASP.NET 2.0 Framework produces standards compliant and accessible code.  To assure that your ASP.NET 2.0 form fields are properly labeled, you must use the AssociatedId property for the ASP.NET Label control in order to make the .NET Framework spew the correct HTML:

    <table>
    <tr>
        <td><asp:Label AssociatedControlID="txtFirstName"
          runat="server">First Name:</asp:Label></td>
        <td><asp:TextBox ID="txtFirstName" runat="server" /></td>
    </tr>
    <tr>
        <td><asp:Label AssociatedControlID="txtLastName"
          runat="server">Last Name:</asp:Label></td>
        <td><asp:TextBox ID="txtLastName" runat="server" /></td>
    </tr>
    </table>

Tuesday, December 20, 2005 3:24:50 PM UTC :: Filed Under ASP.NET

With the release of the final version of Visual Studio Team Systems rapidly approaching (January of 2006), many of you are probably wondering if it’s time to bail on using NUnit for your ASP.NET 2.0 projects in favor of the VSTS unit testing tools.  Well, worry no longer as Jim Newkirk has created a NUnit Add-On that converts NUnit Test Code into tests compatible with Visual Studio 2005 Team System.

The converter is a free download available on the gotdotnet site:

NUnit Add-Ons: Workspace Home

Saturday, December 17, 2005 9:48:14 PM UTC :: Filed Under ASP.NET

The following is Fritz Onion’s posting on Complex data binding expressions in ASP.NET, converted into VB.NET:

I often find when using templated data-bound controls (in either ASP.NET 1.1 or 2.0) that my expressions become rather difficult to understand because of the need to fit all of your logic into a single expression. For example, I have seen databound expressions that look something like:

<asp:TemplateField HeaderText="SomeColumn">
  <
ItemTemplate>
    <%# ((bool)Eval("foo")) ? Eval("bar") : (((bool)Eval("quux")) ? Eval("a") : Eval("b")) %>
  </ItemTemplate>
</
asp:TemplateField>

Which is even worse in 1.1 because each Eval must be replaced with DataBinder.Eval(Container.DataItem, "xx"). There are also occasions where you just can't compress all the logic you need to into a single expression. An alternative, which I find myself using quite a bit, even when developing in 2.0, is to write a single method in your code behind class to generate the desired string. Have it take an object reference (which will be the bound row) and take as many lines as you like to construct the string to be generated in the template. Here's a method that returns the same string as the overly-complex expression above:

Protected Function GenerateFooString(ByVal dataItem As ObjectAs String
    Dim 
foo As Boolean = CType(DataBinder.Eval(dataItem, "foo"),Boolean)
    
Dim quux As Boolean = CType(DataBinder.Eval(dataItem, "quux"),Boolean)
    
Dim ret As String = string.Empty
    
If foo Then
        
ret = CType(DataBinder.Eval(dataItem, "bar"),String)
    
ElseIf quux Then
        
ret = CType(DataBinder.Eval(dataItem, "a"),String)
    
Else
        
ret = CType(DataBinder.Eval(dataItem, "b"),String)
    
End If
    Return 
ret
End Function

And the simplified template now looks like:

 <asp:TemplateField HeaderText="SomeColumn">
  <
ItemTemplate>
    <%# GenerateFooString(Container.DataItem) %>
  </ItemTemplate>
</
asp:TemplateField>

Once again, this is not my code or idea; it all belongs to Fritz Onion!

Navigation
On this page....
Search
Archives
<December 2005>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Categories
Contact me
Send mail to the author(s) Contact Todd M. Taylor