User351619809 posted
Hello All,
I have the following code on my page. Whenever, user tab out of the field txtAddress, a textChanged event is triggered and the cursor looses the focus. I want to put the focus on next field after the txtAddress field. The next field is txtCity field.
Also, although, I have a updatePanel around the txtAddress field, but still, I can see a postback when I tab out of txtAddress field by the flicker on the page and page scrolls up.
<asp:UpdatePanel ID="up1" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional" >
<ContentTemplate>
<div style="width: 100%;" class="ui-block-a ui-margins" >
<label for="field_Address_DOT_Address1" class="required" >Address </label>
<asp:TextBox autocomplete="stop" maxlength="128" ID="txtShipAddress" runat="server" style="text-transform:uppercase;" OnTextChanged="txtAddressTextChanged" AutoPostBack="true" ></asp:TextBox>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="txtShipAddress" />
</Triggers>
</asp:UpdatePanel>
below is my code behind:
protected void txtAddressTextChanged(object sender, EventArgs e)
{
if (POBoxValidator().Equals(1))
{
pnlMessage.Visible = true;
}
else
{
pnlMessage.Visible = false;
}
SetFocus(txtCity);
upPanel.Update();
SetFocus(txtCity);
txtCity.Focus();
}
Below is my pnlMessage code in aspx page:
<asp:UpdatePanel runat="server" ID="upPanel" UpdateMode="Conditional" ChildrenAsTriggers="false" >
<ContentTemplate>
<asp:Panel ID="pnlMessage" runat="server" Visible="false" >
<div class="ui-radio ui-btn" style="font-size:20px;">
<span style="color:red"><b> Note: This is a test message</b> </span>
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
any help will be greatly appreciated.