I have to do two seemingly mutually exclusive things on leaving an asp:textbox. Please help me get some clairity
<p>This project has gone from being a simple '99 Ford F-150 to <a href="http://imgur.com/UWkZ0" rel="nofollow">the Homer</a>.</p>

<p>I've got controls with a gridview with textboxes for data entry.  </p>

<p>All the user controls on the pages are in AJAX updatepanels.</p>

<p>User types in a database column or budget entity or some other financial thing they want to include in the report.</p>

<p>The textboxes in the gridview have autopostback = true set.</p>

<p><b>overly long background info</b></p>

<p>When the user leaves the textbox, during the postback (triggered by onTextChanged) I do some validation back on the server on their entry - regexs, do they have rights to that column, is that column locked, etc.  If it fails, I put a error message next to the textbox.  If it passes, I wipe out any title or error that used to be next to the code.</p>

<p>Focus is getting lost from the postback if they're tabbing out of the box, rather than going to the next textbox in the gridview.</p>

<p>So to fix <em>that</em> I need, if their leaving the tb via the tab key, to also figure out what textbox or gridviewrow they're on, if they're not on the last row, and after the validation and labeling, put the focus on the textbox in the next row.</p>

<p>I can't figure out how, in ontextchanged, to find <em>what</em> caused me to leave the textbox, so I'm thinking use javascript onkeyup to test the key pressed and then find the next box etc, but the ontextchanged fires first and then the js never does, and also, since the control is all AJAXed, the javascript can't find the textboxes because when you enter the page everything is collapsed (the requirements people loooove to collapse and expand things), and so when it's expanded, all the 'new' textboxes are up in the viewstate stuff in the page source, and not down where javascript can see them.</p>

<p><b>The questions</b></p>

<p>So I'm wondering if I can have an onblur in the javascript that can trigger a postback where I can do my validation and such, and either 1) include the keypressed or pick it out of sender in the event or 2) followup the onblur with onkeyup and <em>somehow</em> figure out what textbox is next on the grid and throw focus there.</p>

<p>Or, is there another .NET based approach that could work for this?  In terms of tearing the whole thing down and starting from scratch, I couldn't sell that to the bosses, I'm past the point of no return as far as that goes.</p>
