> ' Add the onkeypress event to a textbox control > ' expO1 Control > Public Function FindControlRecursiveTextboxOnKeyPress(ByVal toControl As Object) As Boolean > Dim loControl As System.Web.UI.Control = New System.Web.UI.Control > Dim loTextbox As System.Web.UI.WebControls.TextBox = New System.Web.UI.WebControls.TextBox > > ' For each control in this form > For Each loControl In toControl.Controls > > ' If we have controls > If loControl.HasControls Then > FindControlRecursiveTextboxOnKeyPress(loControl) > End If > > ' If this is a textbox > If TypeOf loControl Is System.Web.UI.WebControls.TextBox Then > > ' Assign this control to a textbox variable > loTextbox = loControl > > ' If this is a regular texbox > If loTextbox.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine Or _ > loTextbox.TextMode = System.Web.UI.WebControls.TextBoxMode.Password Then > > ' If this is not read only > If Not loTextbox.ReadOnly Then > > ' If this is enabled > If loTextbox.Enabled Then > > ' If this is not a pick list > If oApp.At("LXFrameworkLabel", loTextbox.ID) = 0 Then > > ' Add the onkeypress to the textbox > loTextbox.Attributes.Add("onkeypress", "FormKeyPress(event)") > > End If > > End If > > End If > > End If > > End If > > Next > > Return True > End Function >Thanks,
LayoutItem liFirstName = editForm.FindItemOrGroupByName("liFirstName") as LayoutItem; ASPxTextBox txtFirstName = (ASPxTextBox)liFirstName.GetNestedControl(); txtFirstName.Text = firstName;