Login Control, ImageButton, Default Button...

I feel like I do a lot of bitching about the DefaultButton property.  But anyway...

What happens when you're using a Login control, and you decide to use an ImageButton for the Login button?  You guessed it, you break the DefaultButton property.

''Make the login button of the login control the default button. This is useful when your login control uses an image button.

''Doing so makes the DefaultButton property do nothing.

Dim loginControl As Control = Me.FindControl("Login1")

If Not loginControl Is Nothing Then

Dim loginButton As Control = loginControl.FindControl("LoginButton")

If Not loginButton Is Nothing Then

pnlLogin.DefaultButton = loginButton.UniqueID.Remove(0, pnlLogin.Parent.UniqueID.Length + 1)

End If

End If

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Print | posted @ Monday, August 25, 2008 12:09 PM

Twitter