nevets2001uk
IS-IT--Management
I have an UpdatePanel with a few textboxes. If the value in one textbox is less than the value in another the background turns pink and a hidden textbox (held in a placeholder) is shown.
This all works but the issue I'm having is that I'd like to ensure the focus after the partial postback is set to the next control on the page so that the user can continue to tab through the fields. Currently the focus is lost and you have to mouse click in the next textbox to continue entering data.
Is there a relatively quick way I can achieve this?
Steve G (MCSE / MCSA:Messaging)
Code:
Protected Sub txtAccepted_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtAccepted.TextChanged
If Not txtQuantity.Text Is Nothing AndAlso Convert.ToInt16(txtQuantity.Text) > 0 Then
If Convert.ToInt16(txtAccepted.Text) < Convert.ToInt16(txtQuantity.Text) Then
plhNCR.Visible = True
rvalNCR.Enabled = True
txtAccepted.BackColor = Drawing.Color.LightPink
txtNCR.Focus()
ElseIf Convert.ToInt16(txtAccepted.Text) > Convert.ToInt16(txtQuantity.Text) Then
txtAccepted.Text = txtQuantity.Text
plhNCR.Visible = False
rvalNCR.Enabled = False
txtAccepted.BackColor = Drawing.Color.LightGreen
drpOperator.Focus()
Else
plhNCR.Visible = False
rvalNCR.Enabled = False
txtAccepted.BackColor = Drawing.Color.LightGreen
drpOperator.Focus()
End If
End If
End Sub
This all works but the issue I'm having is that I'd like to ensure the focus after the partial postback is set to the next control on the page so that the user can continue to tab through the fields. Currently the focus is lost and you have to mouse click in the next textbox to continue entering data.
Is there a relatively quick way I can achieve this?
Steve G (MCSE / MCSA:Messaging)