ASP.NET - Add Attributes To All Text Boxes On Page

I have this code, and it works:
With Me
            .txtFullName.Attributes.Add("onfocus", "'#F4EDBD';")
            .txtFullName.Attributes.Add("onblur", "'#FFFFFF';")
        End With

I want to do this with ALL text boxes on the page though.  How can I loop through all the controls and do this just for the text boxes so I want have to manually type all the ID names for the text boxes?  I have my code in the Page_Load event.
Who is Participating?
redmissionConnect With a Mentor Author Commented:
I looped through all the controls in the page and sent them to this procedure, and this happens to work!  I'm not sure why yours wouldn't work though.

Public Sub ColorTextBoxes(ByVal _c As Control)
        Dim c As Control, t As TextBox
        For Each c In _c.Controls
            If (TypeOf c Is TextBox) Then
                t = CType(c, TextBox)
                t.Attributes.Add("onfocus", "'#F4EDBD';")
                t.Attributes.Add("onblur", "'#FFFFFF';")
            End If
    End Sub
Dim c As Object    
        For Each c In Page.Controls
             If (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")) Then
                  Dim tb As TextBox = DirectCast(c, TextBox)
                  tb.Attributes.Add("onfocus", "'#F4EDBD';")
                  tb.Attributes.Add("onblur", "'#FFFFFF';")
               End If
redmissionAuthor Commented:
I put this code in the Page Load event.  It's the only code in that event.  And it doesn't work on the page.  I tested in Firefox, IE, Safari...Javascript enabled in all browsers.
Yeh thats strange. Ah well you got it working now.
All Courses

From novice to tech pro — start learning today.