title: How to maintain tab order after postback
body: <p>The requirement is for some calculation to happen on entering a value in the textbox and since calculation is same ontextchanged is linked to the same event.
  When I tab out it neatly goes to next control and does a postback to Calculate.</p>
  
  <p>Now after the postback and the server side is called and executed, the tab order is messed up and on tab it does not bring focus to the correct control. It always points to the URL in the browser window. </p>
  
  <p>Please let me know how do i retrieve the control which should be next in focus after the postback using the tabIndex.</p>
  
  <pre><code>  &lt;asp:TextBox ID="txtDiscount" runat="server" CssClass="NormalTextBox" TabIndex="45"
                                      MaxLength="3" OnTextChanged="btnCalculatePrice_Click" AutoPostBack="True"&gt;&lt;/asp:TextBox&gt;
  
  
    protected void btnCalculatePrice_Click(object sender, EventArgs e)
      {....
  </code></pre>
  
  <p>}</p>
  
  <p>I tried the below code but didnt know how to fetch the exact control</p>
  
  <pre><code>   if(sender!=null)
          {
              WebControl reqCtrl = (WebControl)sender;
              int taborder = reqCtrl.TabIndex;
              int nexttabOrder = taborder + 1;
  
          }
  </code></pre>