2003-05-20

Using .ID to solve my SetFocus problem.

Yesterday I blogged about a problem I was having using .ClientID.

Dan replied with a few comments that sparked a set of new ideas.

In my CreateChildControls() [1] method I specified an arbitrary name for my control using the .ID property. Next I exposed my control using a readonly property [2] which I pass to the SetFocus() routine:


[1]
Protected Overrides Sub CreateChildControls()
wtCertTextBox = New TextBox()
wtCertTextBox.ID = "WtCertTextBox"
...
End Sub

[2]
Public ReadOnly Property WeightCertTextBox() As TextBox
Get
Return (wtCertTextBox)
End Get
End Property

[3]
SetFocus(LookupControl.WeightCertTextBox)

0 Comments:

Post a Comment

<< Home